DevOpsDocker basicsLesson 55 / 69

Containers explained

Docs15 min

Containers explained

"Works on my machine" ends with containers. A container packages an app with everything it needs — runtime, dependencies, config — so it runs identically anywhere:

  • Image — the recipe, frozen and versioned.
  • Container — a running instance of the image.
  • Registry — where images live (Docker Hub, GitHub Packages).

The image is the unit of shipping: the same PostgreSQL image (postgres:18.6-alpine) powers your laptop, your CI, and production — this app's own docker-compose.yml and both CI workflows depend on exactly that image.

Exercise

Run docker compose up -d in this repo. List the container, its image, and its port mapping. Then explain the difference between image and container.