Docker Daemon (dockerd) is the server that does the actual work when you run Docker commands. It's part of the Docker Engine - and if you're stuck on Docker 20.10.x like half the enterprise world, you get to deal with that BuildKit memory leak. Even the newer 24.x versions randomly corrupt the overlay2 storage driver when you least expect it.
How It Actually Works (Until It Doesn't)
When you run docker run hello-world
, your Docker client talks to dockerd through a socket at /var/run/docker.sock
. The daemon then does a bunch of stuff: pulls the image, creates a container, sets up networking, and starts the process. This works great until the daemon hangs, which is basically every other Tuesday.
I've seen dockerd eat like 3.7GB of RAM on production servers just because someone left too many dangling images around. Lost a weekend to this exact issue. The daemon handles everything from image layers to container networking, and when any of these subsystems gets stuck, your entire Docker setup becomes useless.
The Socket Permission Dance
Here's something they don't tell you in the tutorials: Docker daemon runs as root and owns that socket. Try running docker ps
as a non-root user and you'll get permission denied connecting to /var/run/docker.sock
. The "solution" is adding users to the docker group, which effectively gives them root privileges - great for security, right?
Memory Usage Reality Check
Docker daemon eats RAM like there's no tomorrow. Sure, it starts around 800MB, but I've debugged production issues where dockerd hit 6GB+ because of image layer accumulation and container metadata bloat. The daemon uses Linux namespaces and cgroups for isolation, but good luck debugging when it starts swapping your host to death.
Container startup times are supposedly 1-2 seconds in benchmarks, but try spinning up a Spring Boot app on a busy production box and watch that number become 45+ seconds while the daemon contemplates its life choices. Docker 20.10.x has that lovely memory leak in BuildKit that makes things even worse.
When Docker Daemon Dies
Here's the fun part: when dockerd crashes (and it will), your running containers keep going but you lose all management. No docker ps
, no docker stop
, nothing. You end up with zombie containers that you can only kill with kill -9
. The live restore feature is supposed to reconnect, but half the time it just creates more confusion.
The API Everyone Hates to Love
The Docker API is how everything talks to the daemon - Docker Compose, Kubernetes, Portainer, whatever. It's a REST API that works over Unix sockets or TCP (if you're brave enough to expose it). The problem? When the daemon locks up, the API hangs too, and every tool trying to talk to Docker becomes useless.
The containerd integration was supposed to make things better by offloading work, but now you have two things that can break instead of one. Spent my entire Saturday in December 2023 debugging this exact scenario when containerd 1.7.0 had that fun bug where it would deadlock on image pulls.