31

This is the Docker architecture: enter image description here I am not able to figure out why does one need the docker daemon. The client is good enough. The client simply accesses the daemon using Unix socket. It can use TCP, but what I notice is usually the client and daemon are on the same machine! So why two separate entities?
As mentioned above.. client can use TCP to communicate with daemon. So what is the preferred way to work in a team? One daemon for whole team on separate server with each dev running a client? Or each dev has his own daemon process.

1
  • 3
    Here is your mistake: "... what I notice is usually the client and daemon are on the same machine!" On large production systems, this is not true.
    – SiKing
    Mar 7, 2017 at 20:50

4 Answers 4

34

Docker client provides cli only, it is just an http api wrapper, Like aws cli.

Docker daemon is the brain behind the whole operation, like aws itself. When you use docker run command to start up a container, your docker client will translate that command into http API call, sends it to docker daemon, Docker daemon then evaluates the request, talks to underlying os and provisions your container.

Please note docker cli can connect to remote docker daemon, and you can configure your docker daemon to use tcp IP.

Question in my mind was, what is the preferred way to work in a team? One daemon for whole team on separate server with each dev running a client? Or each dev has his own demon.

This is up to you but most of the time developers have a local docker daemon and client, building Images using dockerfiles. If they need to share docker images, You can provide local docker registry or use public ones. This way, Taking advantage docker you can have exact same dev environment at developers disposal. This development environment will be similar to production environment.

2
  • Farhad that is true. As I mentioned.. client can use TCP to communicate with daemon. Q in my mind was, what is the preferred way to work in a team? One daemon for whole team on separate server with each dev running a client? Or each dev has his own demon. Mar 7, 2017 at 19:52
  • 1
    @ApurvaSingh thanks for clarification, Updated the answer. Mar 8, 2017 at 12:33
6

Q in my mind was, what is the preferred way to work in a team? One daemon for whole team on separate server with each dev running a client? Or each dev has his own demon

Each dev is working with its own Docker daemon and container: the idea with Docker is to be able to specify (Dockerfile) a container that each developer can rebuild and use locally, with the assurance that docker build will produce the exact same image.
Or they can docker push an image an reuse it on their own local docker daemon instance.

But in any case, the docker daemon is per server, meaning you would share it through a team only if said team accessed a common server. If not, they can install docker on their workstation in which case, each one have their own docker daemon.

3

Docker daemon is installed on a host machine and essentially acts as the brain of the Docker; it creates and manages your Docker images on your behalf. Its whole purpose is to perform the commands that the client issues.

For instance, if you issue Docker stop command for a particular container, the daemon will go ahead, find the container and stop it.

Also, whenever your container needs access to the network ports, storage volumes or any other components at the operating system level, Docker daemon will provide that.

3

Why do we need docker daemon? Docker daemon resides or installed on hosts (your local) machine. It is the brain of your entire docker. It manages all images and containers. Its whole work is to get commands from hosts using cli and performs action on docker using docker API. For example if you put docker stop in cli, then docker demon will use that command and performs respective action on docker. Also note that if you fire a command to access certain images/container which is not on your local machine, then this daemon will take that command and go to docker registry to download and run that images.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.