Docker
/Intermediate
Docker Volumes
Definition
The absolute preferred, Docker-native mechanism for persisting data. Volumes are entirely managed by Docker, stored in a secure part of the Linux host filesystem (`/var/lib/docker/volumes/`), and are fully isolated from other host applications.
Explain Like I'm New
A magical, secure USB drive created by Docker. You ask Docker for a volume named 'my-data'. Docker hides it safely deep in the system files. You plug 'my-data' into your container.
Real World Example
Creating a volume with `docker volume create db-data`. Then running `docker run -v db-data:/var/lib/mysql mysql`. The database thinks it's writing to its own internal folder, but the data is safely accumulating in the Docker Volume.
Common Use Cases
- •Database storage
- •Cross-container data sharing
- •Cloud backups
Architecture & Flow
Interview Questions
basic
- If you delete the container using a Docker Volume, does the Volume get deleted too?
intermediate
- What is a major advantage of Docker Volumes over Bind Mounts regarding cloud backups?