13: Volumes and persistent data
Stateful applications that persist data are more and more important in the world of cloud-native and microservices applications. So, we’ll turn our attention in this chapter to investigating how Docker handles applications that write persistent data.
We’ll split the chapter into the usual three parts:
- The TLDR
- The deep dive
- The commands
Volumes and persistent data - The TLDR
There are two main categories of data — persistent and non-persistent.
Persistent is the data we need to keep. Things like customer records, financial data, research results, audit logs, and even some types of application log data. Non-persistent is the data we don’t need to keep.
Both are important, and Docker has solutions for both.
To deal with non-persistent data, every Docker container gets its own non-persistent storage. This is automatically created for every container and is tightly coupled to the lifecycle of the container. As a...