Docker images and containers: what changes at runtime?
Distinguish immutable image content from a container instance, its writable layer, mounted data, and lifecycle.
An image packages filesystem content and startup configuration. A container is an instance created from that image, with its own configuration and lifecycle. It can be running or stopped: a stopped container is still a container.
A useful analogy is a class and an object, provided you remember that Docker also manages filesystems, processes, and networking. One image can supply many containers without each instance changing the original image.
Images store the starting point
Images usually contain read-only filesystem layers plus configuration such as a default command and environment. They may be built from a Dockerfile, downloaded from a registry, or imported through another supported workflow.
docker image ls
An unused image consumes storage, but it has no application process consuming runtime CPU. Tags such as myapp:1.0 and myapp:latest can point to the same image, and a tag can later point elsewhere. Distinguish a movable name from the immutable content it currently identifies.
Containers add an instance and a lifecycle
docker container ls
docker container ls -a
docker run creates and starts a container; docker create creates it without starting it. Docker normally adds a writable filesystem layer and sets up the configured isolation, network, and mounts. Options such as host networking or shared namespaces can change those defaults.
Writes to the container's own layer do not modify the image. That layer remains across a stop/start or restart, but disappears when the container is removed. Writes to bind mounts or volumes follow the backing storage's lifecycle instead.
| Task | Command family |
|---|---|
| List images | docker image ls |
| List all containers | docker container ls -a |
| Remove an image reference | docker image rm |
| Remove a container | docker container rm |
| Create an instance | docker create or docker run |
| Capture applicable container changes as an image | docker commit |
FAQ
How do I retain application data?
Use a deliberate volume or bind mount and back it up. Retention outside the writable layer helps data survive container replacement, but explicit volume deletion or loss of the backing host can still destroy it.
Does a stopped container occupy disk space?
Yes. Its writable layer and other retained resources can remain. Inspect docker system df -v before pruning stopped containers; a stopped database may still contain important data.
Can I turn changes into another image?
docker commit captures applicable filesystem and configuration changes, excluding mounted volume contents. A versioned Dockerfile and reproducible build usually provide a clearer maintenance path.
Can the same image run on every architecture?
A platform-specific image needs a compatible operating system and architecture, or suitable emulation. A multi-platform image index can select an available matching variant. An architecture mismatch may produce exec format error; the existence of a tag alone does not guarantee compatibility.
See images, containers, and storage.
Contact us
Join the community
to join the community
Try Guance
Start online and pay only for what you use.
Get startedChoose a Guance plan