Chapter 4. Working with storage and volumes

 

This chapter covers

  • Introducing mount points
  • How to share data between the host and a container
  • How to share data between containers
  • Using temporary, in-memory filesystems
  • Managing data with volumes
  • Advanced storage with volume plugins

At this point in the book, you’ve installed and run a few programs. You’ve seen a few toy examples but haven’t run anything that resembles the real world. The difference between the examples in the first three chapters and the real world is that in the real world, programs work with data. This chapter introduces Docker volumes and strategies that you’ll use to manage data with containers.

Consider what it might look like to run a database program inside a container. You would package the software with the image, and when you start the container, it might initialize an empty database. When programs connect to the database and enter data, where is that data stored? Is it in a file inside the container? What happens to that data when you stop the container or remove it? How would you move your data if you wanted to upgrade the database program? What happens to that storage on a cloud machine when it is terminated?

4.1. File trees and mount points

4.2. Bind mounts

4.3. In-memory storage

4.4. Docker volumes

4.5. Shared mount points and sharing files

4.6. Cleaning up volumes

4.7. Advanced storage with volume plugins

Summary

sitemap