Storage for Dockers
Docker storage covers how containers keep data beyond their own lifetime. Volumes are Docker-managed directories, bind mounts map a host path into the container, and tmpfs mounts live in memory. The unit also covers passing configuration and secrets into containers without baking them into images.
Stage: Data and Networking · Part of the Docker roadmap · Last reviewed 19 November 2026
What to learn in Storage
- Create a named volume and mount it so database files survive container removal
- Choose between a volume, a bind mount and a tmpfs mount for a given need
- Mount source code from the host to get live reload during development
- Pass configuration through environment variables and env files
- Supply sensitive values with secrets instead of writing them into image layers
Storage interview questions
What happens to data written inside a container when it is removed?
Data in the container's writable layer is deleted with the container. To keep it, mount a volume or bind mount at the path where the application writes, such as the database data directory. The data then lives outside the container lifecycle.
When would you pick a bind mount over a named volume?
Bind mounts suit development, where you want host files such as source code visible inside the container immediately. Named volumes are better for application data, because Docker manages their location, they work the same across platforms and they are easier to back up and share.
Where Storage fits in the Docker roadmap
Storage belongs to the Data and Networking stage (beginner level), which takes about 12 hours. Connect and persist.
Other units in this stage
Back to the full Docker roadmap