Docker Overview - snir1551/DevOps-Linux GitHub Wiki
Docker is an open platform for developing, shipping, and running applications in containers.
Containers allow developers to package applications with all dependencies, enabling consistent behavior across environments.
-
Fast delivery and automation – Ideal for CI/CD pipelines: from development to production, everything runs in the same container.
-
Portability and flexibility – Containers run consistently across environments (dev, staging, production, cloud, on-prem).
-
Efficient use of resources – Containers are lightweight and can run more workloads on the same hardware compared to virtual machines.
Docker follows a client-server model:
-
Docker Daemon (dockerd) – Listens to API requests and manages objects like containers, images, volumes, and networks.
-
Docker Client (docker) – The main user interface, which communicates with the daemon via CLI commands like docker run, docker build, etc.
-
Docker clients can connect to remote Docker daemons over a network using a REST API.
Available for Windows, macOS, and Linux. It includes:
-
Docker CLI
-
Docker daemon
-
Docker Compose
-
Docker Content Trust
-
Kubernetes (optional)
-
Credential helper
A registry stores Docker images.
-
Docker Hub is the default public registry.
-
You can also set up a private registry.
-
Images are uploaded and downloaded using docker push and docker pull.
Images – Read-only templates with instructions to create containers. Built from Dockerfile, each command creates a layer.
Containers – Runnable instances of images. Created with docker run. They include:
- Writable layer on top of the image
- Networking and process isolation
- Destroyed or persisted depending on configuration
Docker uses Linux kernel features:
-
Namespaces – For isolation (processes, networking, filesystems)
-
Control Groups (cgroups) – For resource limits (CPU, memory, etc.)
-
On Windows/Mac, Docker runs in a lightweight VM to simulate Linux kernel behavior.
-
Docker pulls the ubuntu image if it's not local.
-
A new container is created from the image.
-
A writable layer is added.
-
The container gets a unique network ID and virtual filesystem.
-
The command /bin/bash runs inside the container.
-
When you exit, the container stops, but its data may persist depending on setup.