Volumes, Bind Mounts, and Data Lifecycle
Container filesystems are ephemeral -- when you remove a container, everything inside it is deleted. If you are running a database, uploading files, or storing any data that matters, you must mount external storage. This module covers how.
Golden Rule
If you run a database without a volume, your data will be deleted when the container is removed.
How Storage Works in Docker
What You Will Learn
| Lesson | What It Covers |
|---|---|
| Volumes vs Bind Mounts | When to use each storage type, with practical examples |
| Backup and Restore | Portable patterns for backing up and migrating volume data |
Quick Decision Guide
| Question | Answer |
|---|---|
| Is it a database or persistent app state? | Use a named volume |
| Is it source code during development? | Use a bind mount |
| Is it temporary data (cache, sessions)? | Use tmpfs |
| Is it a config file injected from the host? | Use a bind mount (read-only) |