Docker Daemon
The Docker daemon (dockerd) is the background service that manages images, containers, networks, and volumes. The docker CLI is only a client that sends API requests to it, usually over the Unix socket /var/run/docker.sock.
What the daemon does
When you run docker run nginx, the CLI sends a REST request to dockerd. The daemon pulls the image if needed, prepares networking and storage, and asks containerd to start the container, which uses runc to create namespaces and cgroups.
Kubernetes talks to containerd directly through CRI, which is why it could drop Docker as a runtime and still run Docker-built images.
The socket
ls -la /var/run/docker.sock# srw-rw---- 1 root docker ... /var/run/docker.sockcurl --unix-socket /var/run/docker.sock http://localhost/containers/jsonOnly root and members of the docker group can use it.
Configuration
{ "log-driver": "json-file", "log-opts": { "max-size": "100m", "max-file": "3" }, "storage-driver": "overlay2", "live-restore": true}log-optsrotates container logs.storage-driverselectsoverlay2, the recommended driver on modern Linux.live-restorekeeps containers running while the daemon restarts.
sudo systemctl status dockersudo systemctl restart dockersudo journalctl -u docker.service -fdocker infoTroubleshooting
| Symptom | Fix |
|---|---|
Cannot connect to the Docker daemon |
sudo systemctl start docker |
permission denied on socket |
Add user to docker group, log in again |
| Fails after config edit | Validate daemon.json syntax |
No space left on device |
docker system prune after reviewing |
SecurityAccess to the Docker socket is effectively root on the host. Never mount it into untrusted containers, and never expose it over TCP without mutual TLS.
TipEnable
live-restorein production so daemon upgrades do not stop containers.
Frequently Asked Questions
Where does the docker CLI end and the daemon begin?
The CLI is a thin client that sends API requests. The daemon does the work: pulling layers, managing networks and volumes, and coordinating containerd and runc. That is why the CLI can target remote daemons or other clients.
Why is mounting docker.sock into a container dangerous?
Anyone who can call the daemon can start a privileged container with the host filesystem mounted, which is root on the host. If a tool needs Docker API access, use a restricted proxy or a rootless alternative.
What does live-restore do?
It keeps running containers alive while dockerd is stopped or restarted, which allows daemon upgrades without downtime for containers.