Course contentsShow
← Docker, Kubernetes & CI/CD
Lesson 21 of 8021. Container FundamentalsFree lesson

Understanding the Docker Client-Server Architecture

Learners will identify the distinct roles of the Docker CLI client and the background daemon process in executing container commands.

In this lesson, you will learn how the Docker CLI works as a messenger to control the background processes that actually build and run your containers.

The Two Sides of Docker

When you type a command like docker run, you are interacting with only one half of the Docker architecture. Docker is designed as a client-server application, which means it relies on two separate components working in tandem to get the job done.

The Docker Client

The docker command you type into your terminal is the Docker Client. It acts as the primary interface for you, the user. However, the client is actually "hollow"—it does not contain the logic to create filesystems, isolate processes, or manage namespaces. Instead, whenever you enter a command, the client simply packages your instructions and sends them to the server via an API.

The Docker Daemon (The Server)

The real "muscle" of the system is the Docker Daemon (dockerd). This is a background process that runs continuously on your host machine. The daemon is the component that actually performs the heavy lifting. It listens for requests from the client, interacts with the operating system kernel to set up the namespaces and cgroups we discussed in previous lessons, and manages the lifecycle of your containers.

How They Collaborate

Imagine you want to start a container. The interaction looks like this:

  1. You: Type docker run hello-world in your terminal (The Client).
  2. The Client: Sends your request over a communication socket to the daemon.
  3. The Daemon: Receives the request, pulls the necessary image, allocates resources using cgroups, applies the appropriate namespaces for isolation, and starts the container process.
  4. The Daemon: Reports the status back to the client, which then displays the output on your screen.

This architecture is powerful because the client and the daemon do not necessarily need to run on the same machine. You could technically use your local terminal (client) to command a Docker daemon running on a powerful server across the network.

Key Takeaway: The Docker CLI is merely a messenger that sends your instructions to the Docker Daemon, which is the background engine responsible for actually managing container lifecycles and enforcing kernel-level isolation.