01. What is Docker
01. What is Docker
What is Docker
Prerequisites
1. What is Docker
Docker is a containerization platform that allows developers to package an application and its dependencies into a lightweight, portable unit called a container.
Unlike virtual machines, containers share the host OS kernel, making them:
- Faster to start
- More lightweight
- Easier to deploy consistently
2. Key Components
| Term | Description |
|---|---|
| Image | Blueprint for containers |
| Container | Running instance of an image |
| Dockerfile | Instructions to build an image |
| Volume | Persistent storage |
| Network | Communication between containers |
| Registry | Storage for images |
2-1. Docker Engine
The core runtime that manages containers.
It consists of:
- Docker Daemon (dockerd) → Runs in the background (Back-end server)
- Docker CLI → User interface (
docker run,docker build, etc.) - REST API → Communication layer between CLI and daemon
1
2
3
4
5
6
7
8
9
[ You (CLI) ]
↓
docker command (CLI)
↓
REST API Request
↓
Docker Daemon (dockerd)
↓
Container / Image
Daemon:
- build image (docker build)
- run container (docker run)
- manage container (docker start, stop, delete)
- manage network and volumn
2-2. Docker Image
A read-only template used to create containers.
Includes:
- Application code
- Runtime (e.g., Python, Node.js)
- Libraries & dependencies
Built using a Dockerfile
2-3. Docker Container
A running instance of an image.
Characteristics:
- Isolated environment
- Has its own filesystem, network, and processes
- Can be started, stopped, deleted
2-4. Dockerfile
A script that defines how to build an image.
1
2
3
4
FROM ubuntu:24.04
RUN apt-get update && apt-get install -y python3
COPY . /app
CMD ["python3", "main.py"]
2-5. Docker Registry
A place to store and share images.
- Docker Hub (public)
- Private registries
3. How Docker works
3-1. Write Dockerfile
Defines environment and dependencies
3-2. Build Image
1
docker build -t myapp .
3-3. Store Image (Optional)
1
docker push myapp
3-4. Run Container
1
docker run myapp
4. Internal Working Principle
Docker relies on Linux kernel features:
4-1. Namespaces (Isolation)
Provide separation for:
- Process IDs
- Network
- Filesystem
- Users
Each container thinks it’s running alone
4.2 Cgroups (Resource Control)
Control resource usage:
- CPU
- Memory
- Disk I/O
4.3 Union File System (Layered FS)
Images are built in layers:
1
2
3
4
5
Base Image (Ubuntu)
↓
Install Packages
↓
Copy App Code
Benefits:
- Reuse layers
- Faster builds
- Smaller size
5. Container vs Virtual Machine
| Feature | Container | VM |
|---|---|---|
| OS | Shared | Separate |
| Size | Small | Large |
| Boot Time | Seconds | Minutes |
| Performance | Near-native | Slower |
This post is licensed under CC BY 4.0 by the author.