9

I recently discovered rkt, a competitor container runtime to Docker. It seems like rkt does not need a daemon. For me, rkt is like running any other command and it works easily with systemd (or other init systems).

This makes me wonder about the utility of Docker's daemon.

Why does Docker need a daemon ? What does the daemon provide that would not be possible without it ? Is its only goal to remove the need for an init system like systemd (as can be seen in the Rancher OS) ?

conradkleinespel
  • 6,560
  • 10
  • 51
  • 87
  • It provides snadbox bos containers ?? – Antoniossss Jun 30 '17 at 05:59
  • Maybe this helps: https://docs.docker.com/engine/docker-overview/#docker-objects – Héctor Jun 30 '17 at 06:02
  • @Héctor How does this help understanding the utility of the Docker daemon ? – conradkleinespel Jun 30 '17 at 06:03
  • "The daemon creates and manages Docker objects, such as images, containers, networks, and volumes.", " The Docker client talks to the Docker daemon, which does the heavy lifting of building, running, and distributing your Docker containers." Check this: https://coreos.com/rkt/docs/latest/rkt-vs-other-projects.html – Héctor Jun 30 '17 at 06:09
  • 1
    @Héctor Yes, exactly, so if rkt can do it without a daemon, why does Docker need a daemon ? I mean, the daemon adds additional configuration in most cases (enable services, set permissions on Daemon socket, make sure the daemon is not listening on a public IP, etc). So if it's possible to do without, why have a daemon ? – conradkleinespel Jun 30 '17 at 06:11
  • It's just a design decision. It has pros and cons and dotCloud people chose a centralized daemon-based system. That's all. – Héctor Jun 30 '17 at 06:16
  • 1
    Oh OK ! And what are the pros ? Is it about not needing an init system ? Or is it about managing containers accross multiple physical hosts with a single daemon (which seems not to be a common use case these days) ? – conradkleinespel Jun 30 '17 at 06:17
  • Or maybe another way of asking this is: why doesn't the client by default just start the server, handle the request and then close the server each time. – William Entriken Oct 27 '17 at 13:54

1 Answers1

5

Docker was designed as a client/server application which allows you to have remote access to the docker API. This allows tools like the classic container based swarm that were effectively a reverse proxy to a cluster of docker hosts.

The daemon also provides a place for shared state. It's restarting containers according to their restart policy. But it's also managing networks and volumes that may be shared between multiple containers.

Lastly, with the introduction of swarm mode, the daemon is also the central location for these tools that would otherwise be run as their own daemons with tools like kubernetes.

If you need a daemon-less solution but otherwise like docker, then consider using runc which is the runtime environment that docker uses for each container by default.

This doesn't involve the init inside the container. If you need that, docker now includes an optional init that you can enable per container. And you've always had the option to include your own init, like tini, if you needed something to cleanup zombie processes.

BMitch
  • 231,797
  • 42
  • 475
  • 450