Ch. 13 · Docker

Docker Images Versus Running Containers

Docker Images Versus Running Containers. Learn the reasoning, a practical example, common mistakes and an interview exercise.

~2 min readbeginnerupdated Oct 3, 2026

An image is a packaged filesystem and configuration; a container is a runtime instance with its own writable layer and process lifecycle.

Before you start

You should understand the difference between an image, a running container and the host. Record where a file, process or network endpoint actually lives before diagnosing a problem. Commands illustrate local experiments; adapt image names and paths to a disposable development environment.

The practical goal is to reason through this situation: Two containers from one image can run independently with different runtime configuration. Read the walkthrough first, then try the interview exercise before opening its answer. The important part is explaining the decision and its consequences, rather than remembering a definition alone.

Step-by-step walkthrough

Step 1: Identify the artifact

The image supplies packaged files and default configuration.

Step 2: Identify the instance

Each container has runtime processes and its own writable layer.

Step 3: Make fixes reproducible

Change source or Dockerfile and rebuild instead of relying on manual instance edits.

Worked scenario

Two containers from one image can run independently with different runtime configuration.

Two containers start from image V1. Editing a file in container A leaves B and V1 unchanged. Recreating A from V1 loses the edit. Publishing V2 with the fix makes replacement predictable; persistent volumes remain a separate ownership decision.

Common mistake

Changing a running container does not update its original image.

Verify the behavior

Recreate the disposable instance and verify only image-backed or deliberately persisted changes survive.

Interview exercise

Persist a reproducible fix.

Answer and reasoning

Change the Dockerfile or source, rebuild the image and redeploy rather than relying on manual container edits.

Continue learning

Compare the scenario with the Docker interview questions and test your understanding with the Docker MCQs. For terminology and implementation details, consult the reference material.

More in Docker

esc