Docker Concepts
Containers, images, registries, and the Docker architecture explained.
What is Docker?
Docker is a platform for building, shipping, and running applications in containers. A container is a lightweight, isolated environment that packages your application and its dependencies together.
Unlike virtual machines, containers share the host OS kernel. This makes them start in milliseconds and use far less memory than VMs.
Images vs Containers
| Concept | Analogy | Description |
|---|---|---|
| Image | Blueprint / recipe | Read-only template that defines what the container will contain |
| Container | Running instance | A live, running process created from an image |
| Registry | App store | A place to store and distribute images (Docker Hub, GHCR) |
| Dockerfile | Build instructions | A text file that defines how to build an image |
Networking
Docker creates virtual networks that containers can join. By default, containers on the same network can communicate with each other by container name.
bash
# Create a network
$ docker network create my-network
# Run containers on the same network
$ docker run -d --name db --network my-network postgres
$ docker run -d --name app --network my-network my-app
# app can reach db at hostname 'db'
Practice with TLD
The Docker Networking track has labs where you fix broken container network configurations.