What is the difference between a Docker image and a container?easy

Type
conceptual
Topic
fundamentals
Frequency
very common
Tags
fundamentals
Answer

An image is a read-only blueprint (layers of filesystem changes). A container is a running instance of an image with an added writable layer.

Explanation

Images are immutable and shareable - pushed to a registry (Docker Hub, ECR, GCR). Multiple containers can run from the same image simultaneously, each with their own writable layer. Any changes made inside a running container are lost when the container is removed unless committed to a new image or written to a volume. The class/instance analogy applies: image = class, container = instance.

Follow-upHow do you persist data written inside a container?