Course contentsShow
← Cloud and Infrastructure
Lesson 1034 of 2,98920. Docker in DepthFree lesson

Container Writable Layer

Understand the writable container layer, its ephemeral nature, and why data doesn't persist after container deletion.

Container Writable Layer

What you'll learn: How Docker uses a temporary writable layer for each container and why your data disappears when the container is removed.

What Is the Writable Layer?

When you start a container from an image, Docker doesn't modify the original image layers (which are read-only). Instead, it creates a thin writable layer on top of all the image layers. This is where all changes made during the container's lifetime are stored—new files, modified files, deleted files, application logs, everything.

Think of it like writing on a clear sheet of plastic placed over a printed book. The book pages (image layers) never change, but your notes on the plastic (writable layer) can be added, erased, or modified freely.

The Ephemeral Nature

Here's the critical part: the writable layer only exists while the container exists. When you stop a container, the writable layer persists. But when you delete the container (docker rm), that writable layer is permanently destroyed along with all the data it contained.

This is why containers are considered ephemeral (temporary, short-lived). Any data written inside the container—database records, uploaded files, logs—vanishes unless you've specifically planned for persistence using volumes or bind mounts (concepts you'll learn later).

Why This Design?

This design keeps containers lightweight and ensures they remain true to the immutable infrastructure pattern you learned earlier. Containers should be disposable and replaceable. Configuration and important data belong outside the container lifecycle.

Key Takeaway: The container writable layer is temporary storage created when a container runs and destroyed when the container is deleted—any data written inside without using volumes is lost permanently.