Docker · 12-day planAll days
Day 6 of 12 30 minVolumesBind mountsPersistence
See why data inside a container disappears with it, then keep it safe in named volumes, for example a Redis or PostgreSQL database. Share a folder from your machine with a bind mount to edit a website live, and manage volumes with the docker volume commands.
By the end of today you can
- Explain why data written inside a container is lost when it's removed
- Store data in named volumes so it survives new containers
- Share a folder from your machine with a bind mount
- Choose between volumes and bind mounts, and use :ro for read-only
- List, inspect and remove volumes
What's inside
- 5 sections
- 2 diagrams and mind maps
- 5 code examples you can run
- 5-question quiz
- 1The problem: data disappears
- 2Named volumes
- 3Bind mounts: share a folder
- 4Volumes or bind mounts?
- 5Cleaning up
Sign in free to read this lesson
Get the full lesson with diagrams, runnable code and the quiz. Your progress is saved across devices.
Sign in free