Docker & Kubernetes · Module 04
Docker Storage – Volumes, Bind Mounts and Storage Drivers
Understand why data inside a container is easy to lose, choose between volumes, bind mounts and tmpfs, manage volumes and know what a storage driver does.
What you will learn
- Explain the writable layer and when data inside a container is lost
- Choose a volume, bind mount or tmpfs and write it with -v or --mount
- Create, inspect, remove and prune Docker volumes safely
- Identify the storage driver in use and what it affects
Lessons
- Data in a container and the writable layer
Files written in a container live in a thin writable layer that disappears with the container on docker rm.
- Three mount types — volume, bind mount, tmpfs
Volumes are managed by Docker, bind mounts point at any host directory, tmpfs lives only in RAM.
- Managing Docker volumes
Create, inspect, share and clean up volumes; a volume outlives its containers until you remove it.
- Storage drivers
The storage driver stacks image layers and the writable layer on the host; overlay2 is the standard choice, and volumes bypass it.