Docker Daemon
Docker Daemon
The Docker Daemon is one of the most important components of Docker. It is the background service responsible for managing Docker objects such as images, containers, networks, and volumes.
When you execute commands such as:
docker run nginx
docker build -t myapp .
docker pull ubuntu
docker ps
the Docker CLI does not directly create or manage containers. Instead, it communicates with the Docker Daemon, which performs the requested operations.
1. What is the Docker Daemon?
The Docker Daemon is a background process that listens for Docker API requests and manages Docker resources.
On Linux, the daemon process is commonly:
> dockerd
Its primary responsibilities include:
- Creating and managing containers
- Building images
- Pulling and pushing images
- Managing networks
- Managing volumes
- Managing container lifecycle
- Communicating with container runtimes
- Providing the Docker API
- Managing image and container metadata
2. Docker Client vs Docker Daemon
One of the most important concepts to understand is the difference between the Docker Client and the Docker Daemon.
| Component | Purpose |
|---|---|
| Docker CLI | Provides the command-line interface |
| Docker Client | Sends API requests |
| Docker Daemon | Processes Docker API requests |
| Container Runtime | Responsible for running containers |
| Docker Registry | Stores and distributes images |
3. What is dockerd?
dockerd is the Docker daemon process.
You can check whether it is running on a Linux system using:
>systemctl status docker
● docker.service - Docker Application Container Engine
Loaded: loaded
Active: active (running) 4. Starting and Stopping Docker Daemon
On systems using systemd, Docker can generally be managed using:
sudo systemctl start docker
sudo systemctl stop docker
sudo systemctl restart docker
sudo systemctl status docker
sudo systemctl enable docker
sudo systemctl disable docker
5. How Docker CLI Communicates with the Daemon
The Docker CLI communicates with the Docker Daemon through the Docker Engine API.
On a typical Linux installation, communication commonly happens through the Unix socket:
/var/run/docker.sock
Often this is represented by:
/var/run/docker.sock
which may resolve to:
/run/docker.sock
You can check it with:
ls -l /var/run/docker.sock
Example:
srw-rw---- 1 root docker ... /var/run/docker.sock
The s at the beginning indicates that this is a Unix domain socket.