How Docker Works
Docker uses a client-server architecture with three main components.
The Three Components
โโโโโโโโโโโโโโโโโโโโโโโ
โ Docker Client โ โ You (docker CLI)
โ docker run, build โ
โโโโโโโโโโโโฌโโโโโโโโโโโ
โ REST API
โโโโโโโโโโโโผโโโโโโโโโโโ
โ Docker Daemon โ โ dockerd (background service)
โ Builds, runs, โ
โ manages containers โ
โโโโโโโโโโโโฌโโโโโโโโโโโ
โ
โโโโโโโโโโโโผโโโโโโโโโโโ
โ containerd + โ โ Low-level container runtime
โ runc โ
โโโโโโโโโโโโโโโโโโโโโโโ
Key Concepts
- Image โ A read-only template with instructions for creating a container. Think of it as a blueprint.
- Container โ A running instance of an image. You can create many containers from one image.
- Registry โ A storage for images. Docker Hub is the default public registry.
- Dockerfile โ A text file with step-by-step instructions to build an image.
Data Flow
1. You write a Dockerfile
2. docker build โ Docker daemon builds an image
3. docker run โ Docker daemon creates a container from that image
4. Container runs your app in isolation
5. docker push โ Share image to a registry
6. Someone pulls your image and runs it
Dockerfile โ Image โ Container โ Running App