CodeBlanks Logo Icon CodeBlanks

Docker architecture

Learn the architecture of daemon, CLI and registry.

Docker architecture

Docker has a client-server structure:

  • Docker CLI (the docker command): takes the commands you type.
  • Docker daemon (dockerd): runs in the background; manages images, containers, networks and volumes.
  • Registry: the store where images are kept (Docker Hub, GitHub Container Registry...).
docker pull redis   # CLI -> daemon -> download from the registry
docker run redis    # CLI -> daemon -> create a container

A remote daemon

The CLI and the daemon don't have to be on the same machine. The CLI talks to a REST API over a socket or the network; with the DOCKER_HOST variable or docker context you can manage a daemon on another machine:

docker context create sunucu --docker host=ssh://ali@10.0.0.5
docker context use sunucu
docker ps        # now lists the containers on the remote server

Practice Pull and run

Write two commands that first pull the redis image, then start a container named cache from it in the background.

Starter code

terminal
# buraya yaz

Sample solution

terminal
docker pull redis
docker run -d --name cache redis

Expected output

Using default tag: latest
Status: Downloaded newer image for redis:latest
9b1c2d3e4f50

Questions and answers

Review the lesson questions together with their answers. To test yourself, solve the lesson interactively.

1 Which component actually creates and manages containers?

  • Docker Hub
  • The Dockerfile
  • The Docker daemon (dockerd) Correct answer
  • The Docker CLI

Explanation: The CLI only sends requests to the daemon over a REST API.

2 Download an image from the registry.

Question
docker ____ redis
Answer
docker pull redis

Explanation: docker pull downloads the image from the registry into the local store.

3 Match the components with their jobs.

Term Meaning
Docker CLI Sends commands
dockerd Manages containers
registry Stores images
docker context Which daemon to connect to

All lessons in Beginner