- Core Concepts
- Volumes are persistent data stores managed by Docker for containers
- Volumes are isolated from host machine functionality unlike bind mounts
- Volumes persist even after container deletion unless --rm flag used
- Advantages
- Easier backup and migration than bind mounts
- Works on both Linux and Windows containers
- Can be shared among multiple containers safely
- Provides high-performance I/O
- Volume Types
- Named volumes have specific source (e.g. awesome:/bar)
- Anonymous volumes have random names guaranteed unique
- Volume drivers abstract storage system from application logic
- Usage
- Volumes can be mounted using --mount or --volume flags
- Multiple containers can mount same volume simultaneously
- Volume-subpath allows sharing specific volume portions
- Block storage devices can be mounted using local driver
- Management
- Volumes can be created, listed, inspected, and removed
- Volume drivers support NFS, CIFS/Samba, and other storage systems
- Volume definitions can be copied between containers
- Unused volumes can be removed using docker volume prune