A container packages an application process with a controlled filesystem and runtime environment. Learn what an image provides and which data must survive independently of a particular running container.
Distinguish an image from a running container
An image is a template used to start containers; a container is a running or stopped instance with its own writable layer. Rebuilding an image and restarting an instance are different operations. A container is not automatically a full virtual machine with a separate kernel, and its isolation still depends on configuration and the host.
Decide where persistent state belongs
Files written only into a disposable container layer can disappear when that instance is replaced. Use a deliberate volume, managed database or another suitable persistence mechanism for important data. Define backup and restore procedures for that state rather than assuming the image contains everything needed for recovery.
Keep configuration and permissions explicit
Do not bake private credentials into an image that will be distributed. Supply appropriate runtime configuration, limit unnecessary privileges and expose only the required interfaces. A process starting successfully does not prove its dependencies are healthy. Verify a meaningful application check and the behaviour after replacement.
Worked example
A fictional web app stores uploaded covers separately from its image. Replacing the application container should preserve those covers and the database. A recovery rehearsal checks both data stores, because rebuilding the application image alone cannot reconstruct user uploads.
Check your understanding
Try each question before opening its explanation. These are free practice prompts; they do not use game chances.
Is an image the same thing as a container?
No. An image is the template; a container is an instance created from it. An instance can have runtime configuration and writable state not present in the original image.
Why keep uploads outside a disposable writable layer?
Replacing that instance can remove its local state. Important uploads need a deliberate persistent storage and backup strategy.
What should you check after replacing a container?
Check the application response, required service connections, permissions and the continued availability of persistent data. Starting the process alone is not enough evidence.
Sources and further reading
These original examples explain foundational concepts. Use the official references for complete, current details and version-specific behaviour.
About this guide: AI-assisted educational content with original examples and linked primary references. Found an issue? Tell us what to improve.