Docker
/Beginner
Persistent Storage
Definition
The concept of saving data generated by a container so that it survives even if the container crashes, is deleted, or is recreated.
Explain Like I'm New
Containers have amnesia. If you delete a container, every file inside it is instantly vaporized. Persistent storage is plugging an external hard drive into the container. When the container dies, the hard drive (and the data) survives.
Real World Example
Running a MySQL database. If you don't use persistent storage, the moment you restart the MySQL container, all your users and passwords are deleted. By mounting a persistent volume, the database files are safely kept outside the container's volatile memory.
Common Use Cases
- •Databases
- •User uploads
- •Log files
Interview Questions
basic
- By default, are files created inside a Docker container permanent or temporary?
intermediate
- Why does writing data directly into a container's writable layer severely impact performance?