Image vs container

The image is the recipe, the container is the dish: one image can start any number of containers, each with its own state. Deleting a container leaves the image intact, and changing a container never changes the image.

How it works

docker images lists images, docker ps -a lists containers. Each container remembers the image it was created from. To get a change into every container, put it in the Dockerfile, build a new image and recreate the containers.

What breaks

Fixing a file with docker exec repairs one container only. The next container started from the same image, after a crash, a deploy or a recreation, comes back with the old file.

In a terminal

docker images
docker ps -a --format '{{.Names}}  {{.Image}}  {{.Status}}'

See it break, then fix it

Write the Dockerfile or the compose file, type the docker commands, and watch a simulated server run them through reboots, upgrades and traffic. Free to start.