The relationship between a read-only template (image) and a running instance (container).
In the Docker world, the concepts of images and containers are central and often compared to the concepts of classes and objects in programming. A Docker image is a read-only, immutable template that contains a set of instructions for creating a container. It includes everything needed to run an application: the code, a runtime, libraries, environment variables, and configuration files. Images are created from a special instruction file called a `Dockerfile`. Each instruction in the Dockerfile creates a layer in the image. This layered architecture is incredibly efficient; when you change an image, Docker only rebuilds the layers that have changed, and different images can share common layers, saving disk space. A Docker container, on the other hand, is a runnable instance of an image. When you run an image, you create a container. You can create, start, stop, move, and delete many containers from the same image. The container adds a writable layer, known as the 'container layer,' on top of the immutable image layers. Any changes made inside the running container, such as writing new files or modifying existing ones, are stored in this writable layer. This separation ensures that the underlying image remains unchanged. Essentially, an image is the blueprint, and a container is the actual running application built from that blueprint.