Image

An image is a read-only package of everything a program needs to run: files, libraries, environment variables and the command to start. You build it once, then run it anywhere, as many times as you like.

How it works

An image is a stack of layers plus a configuration: CMD, ENTRYPOINT, ENV, USER, WORKDIR and exposed ports. It is identified by a hash of its content, its ID, and can carry several names (tags). docker pull only downloads the layers the server does not already have.

What breaks

An image never changes once built. Editing a source file does nothing to the running container until you rebuild the image and recreate the container from it, a step people often forget.

In a terminal

docker pull redis:7-alpine
docker images
docker image inspect -f '{{.Config.Cmd}}' redis:7-alpine

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.