Docker Volumes vs Bind Mounts: When to Use Which
Understand the key differences between Docker volumes and bind mounts. Learn when to use each storage option for your homelab containers.
Posted by
Related reading
Private Cloud vs Public Cloud: When to Self-Host and When Not To
Understand when self-hosting makes sense and when public cloud is better. A practical guide to choosing between private cloud homelab and AWS/GCP/Azure services.
Homelab Documentation: Wiki.js vs BookStack for Self-Hosted Wikis
Document your homelab setup with self-hosted wikis. Compare Wiki.js and BookStack for creating searchable documentation of your infrastructure and procedures.
Docker Security Scanning: Trivy and Dockle for Safe Containers
Scan your Docker images for vulnerabilities before deploying. Learn to use Trivy and Dockle to secure your self-hosted homelab container infrastructure.

The Storage Dilemma
One of the first challenges every homelab enthusiast faces is understanding Docker storage. When your containers need persistent data, you have two main options: volumes and bind mounts. Choosing the wrong one can lead to permission issues, data loss, or poor performance.
Let's break down both options so you can make informed decisions for your homelab infrastructure.
Docker Volumes Explained
Docker volumes are the preferred mechanism for persisting data generated and used by Docker containers. They are completely managed by Docker and stored in a special location on your host filesystem.
# Create a named volume
docker volume create my_data
# Use it in docker-compose.yml
services:
database:
image: postgres:15
volumes:
- my_data:/var/lib/postgresql/data
volumes:
my_data:Advantages of Docker Volumes:
- Managed by Docker - no permission headaches
- Easy to backup with docker volume commands
- Work on both Linux and Windows
- Can be shared between multiple containers safely
- Support volume drivers for cloud storage
Bind Mounts Explained
Bind mounts map a specific directory on your host machine directly into a container. They've been around since the early days of Docker and give you full control over the storage location.
# Bind mount in docker-compose.yml
services:
web:
image: nginx:latest
volumes:
- ./nginx/html:/usr/share/nginx/html
- ./nginx/nginx.conf:/etc/nginx/nginx.conf:roAdvantages of Bind Mounts:
- Direct access to files from host - great for development
- You control exactly where data is stored
- Easy to edit config files with your favorite editor
- Simple to integrate with existing backup solutions
- No Docker overhead for simple file access
When to Use Docker Volumes
Choose Docker volumes for:
- Database storage: PostgreSQL, MySQL, MongoDB data directories
- Application state: Redis, Elasticsearch indices
- Multi-container sharing: When multiple services need the same data
- Production deployments: Better isolation and management
- Cross-platform projects: When you need Linux/Windows compatibility
When to Use Bind Mounts
Choose bind mounts for:
- Configuration files: nginx.conf, php.ini, custom configs
- Development: Source code that changes frequently
- Media libraries: Plex/Jellyfin media files you manage
- Logs: When you need to access logs from the host
- Existing data: Files that already exist on your system
Practical Homelab Example
Here's a real-world example combining both approaches for a Jellyfin media server:
services:
jellyfin:
image: jellyfin/jellyfin:latest
volumes:
# Docker volume for application data
- jellyfin_config:/config
- jellyfin_cache:/cache
# Bind mounts for media you manage
- /mnt/media/movies:/movies:ro
- /mnt/media/tv:/tv:ro
- /mnt/media/music:/music:ro
ports:
- "8096:8096"
volumes:
jellyfin_config:
jellyfin_cache:Notice how we use volumes for Jellyfin's internal data (config, cache) but bind mounts for media files that we manage outside of Docker.
Common Pitfalls to Avoid
- Permission issues: Bind mounts inherit host permissions - use proper user/group settings
- Accidental deletion:
docker compose down -vremoves volumes! - Relative paths: Bind mounts need relative (./path) or absolute paths
- Performance on Mac/Windows: Bind mounts can be slow on non-Linux hosts
The Bottom Line
For most homelab setups, use Docker volumes for application data and databases, and bind mounts for configuration files and media libraries. This hybrid approach gives you the best of both worlds: Docker-managed reliability for critical data and easy access for files you need to manage directly.
