Images vs Containers

View saved

Images are blueprints

An image is a read-only template: filesystem layers plus metadata that say how to start a process. You usually pull images from a registry such as Docker Hub.

Containers are instances

A container is what you get when you run an image. It has its own writable layer, process tree, network endpoints, and lifecycle (created, running, stopped, removed).

Compare the two

  • One image can create many containers
  • Deleting a container does not delete its image
  • Changing files inside a container does not change the image
  • To keep changes, commit carefully or rebuild from a Dockerfile

Inspect both

List local images and containers with different commands.

docker images
docker ps -a

Comments

One comment per signed-in account. Comments are saved with this page’s URL.