About this chapter
Containers are disposable, and so is the data inside them - unless you tell Docker otherwise. This chapter shows how to persist and share data.
Lessons from courses
- 1 Why data disappears Understand why data written inside a Docker container is ephemeral and disappears when the container is removed - and how to keep it safe.
- 2 Volumes Learn how to create and use Docker volumes with docker volume and -v to keep data, like a database, safe even when containers are removed.
- 3 Bind mounts Learn how Docker bind mounts link a folder on your computer into a container with -v, ideal for editing source code during local development.