Lesson 3: Docker Architecture Explained
Understanding the components of Docker is crucial for troubleshooting and advanced usage.
Docker operates using a client-server architecture. The client talks to the daemon (server), which does the heavy lifting.
1. The Docker Client (CLI)
- This is the primary way users interact with Docker.
- It's a command-line tool (
docker). - The Client sends commands (like
docker run,docker build,docker pull) to the Docker Daemon. - It can communicate with the Daemon locally or remotely.
2. The Docker Daemon (Engine)
- The server component, often called
dockerd. - It manages the Docker objects: images, containers, networks, and volumes.
- It listens for API requests from the Client.
- Key responsibilities include:
- Building images.
- Running, stopping, and managing containers.
- Handling image storage and networking.
3. Docker Registries
- A Registry is a centralized location where Docker Images are stored.
- Docker Hub is the default public registry.
- When you run
docker pull nginx, Docker pulls the Nginx image from Docker Hub. - When you run
docker push, you are sending your custom image to a registry.
Flow of a Command (docker run) (Analogy)
- You (Client): Send the instruction to start a container.
- Daemon (Engine): Receives the instruction.
- Daemon (Image Management): Checks local storage for the requested image.
- Daemon (Registry Interaction): If not found, pulls the image from Docker Hub.
- Daemon (Container Management): Creates and starts a new container instance based on the image.
This architecture ensures that managing containers and images is separated from the user interface, providing efficiency and scalability.