liveBook · Manning

Docker daemon

As explained in Kubernetes in Action, Second Edition

The Docker daemon is the background service that manages Docker images, containers, and container execution.

The Docker daemon does the work behind Docker commands. You type a command into the Docker CLI; the daemon creates containers and builds images. The two need not run on the same computer. section 2.1.3 section 2.2.2

Run a first container

After installing Docker, run `docker run busybox echo "Hello World"`. If the image is not available locally, Docker downloads it before the container prints `Hello World`. section 2.1.3

The CLI–daemon distinction matters when building an image. With `docker build -t kiada:latest .`, the current directory is the build context. Its contents are sent to the daemon, which builds the image from the Dockerfile. Keep unnecessary files out of that directory: transferring them can slow a build, particularly when the daemon is remote. section 2.2.2

$ docker build -t kiada:latest .
[+] Building 6.7s (8/8) FINISHED
 => [internal] load build definition from Dockerfile
 => => transferring dockerfile: 182B
 => [internal] load metadata for docker.io/library/node:23-alpine 
 => [internal] load .dockerignore
 => => transferring context: 2B
 => [1/3] FROM docker.io/library/node:23-alpine...    #1
 => => resolve docker.io/library/node:23-alpine...
 => => sha256:dd44ec6132f29f... 6.49kB / 6.49kB      #2
 => => sha256:18b16449d0c592... 1.93kB / 1.93kB      #2
 => => ...                                           #2
 => [2/3] COPY app.js /app.js    #3
 => [3/3] COPY html/ /html   #4
 => exporting to image
 => => exporting layers
 => => writing image sha256:afeb94f9465c...     #5
 => => naming to docker.io/library/kiada:latest    #6

The build output shows the Dockerfile being loaded, a base image being resolved, files being copied, and the resulting image being named. section 2.2.2

On Linux, Docker can run directly on the computer. With Docker Desktop on macOS or Windows, the CLI runs on the host while the daemon and its Linux containers run in a VM. A daemon can also run on a remote computer. section 2.1.3 section 2.2.2

How Kubernetes in Action, Second Edition covers it

How deep it goes
Explains CLI–daemon separation, build-context transfer, and image-building steps without detailing daemon internals.
Examples
Uses a BusyBox Hello World container and a Dockerfile-based application image build.
What it assumes
Starts with Docker installation and a first container command, then introduces the CLI–daemon distinction.
What you can do after
Diagnose/debug with it by locating where builds run and recognizing why unnecessary build-context files can slow them.
How it connects
Connects the daemon to Docker CLI, containers, Dockerfiles, build contexts, image layers, and remote execution.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Kubernetes in Action, Second Edition. The section links point to the parts of the book it draws on.