Overview
Persistent storage is critical for stateful applications and databases. Dokploy uses Docker volumes to provide reliable, performant storage that persists across container restarts and redeployments.Data Persistence
Data survives container restarts and updates
Performance
Native filesystem performance
Portability
Easy backup, restore, and migration
Volume Types
- Named Volumes (Recommended)
- Bind Mounts
- tmpfs Mounts
- NFS Volumes
Docker-managed volumes:Benefits:
- Managed by Docker
- Automatic creation
- Easy to backup
- Independent lifecycle
Creating and Managing Volumes
Via Docker Compose
docker-compose.yml
Via Docker CLI
Via Dokploy API
Create Mount
Volume Configuration Options
Volume Labels
Organize volumes with labels:Volume Driver Options
Customize volume behavior:Read-Only Volumes
Mount volumes as read-only:Database Storage
Each database type has specific volume requirements:PostgreSQL
MySQL/MariaDB
MongoDB
Redis
Volume Backup and Restore
Backup a Volume
Manual Backup
Restore a Volume
Manual Restore
Automated Backups via Dokploy
Configure automated volume backups:Volume Migration
Between Servers
1
Backup on Source Server
2
Transfer to Target Server
3
Create Volume on Target
4
Restore on Target Server
Between Volume Drivers
Migrate from local to NFS:Storage Drivers
Docker supports multiple storage drivers:- overlay2 (Default)
- btrfs
- zfs
- devicemapper
Modern, performant storage driver:
- Best performance
- Production-ready
- Supports Linux 4.0+
- Copy-on-write
Check Current Driver
Performance Optimization
Use Named Volumes Instead of Bind Mounts
Use Named Volumes Instead of Bind Mounts
Named volumes are faster and more portable:
Enable Volume Caching (macOS/Windows)
Enable Volume Caching (macOS/Windows)
Improve bind mount performance:
Use tmpfs for Temporary Data
Use tmpfs for Temporary Data
Store temporary data in memory:
Optimize Database Volume Configuration
Optimize Database Volume Configuration
PostgreSQL example:
Storage Monitoring
Check Volume Sizes
Monitor Disk Usage
Cleanup Unused Volumes
Multi-Node Storage
For multi-node deployments, use shared storage:NFS Configuration
Volume Placement
Pin volumes to specific nodes:Best Practices
Use Named Volumes
Prefer named volumes over bind mounts for portability
Backup Regularly
Automate volume backups to external storage
Monitor Disk Space
Set up alerts for disk usage thresholds
Document Mount Points
Maintain documentation of all volume mounts
Troubleshooting
Volume permission errors
Volume permission errors
Fix ownership issues:
Volume full / out of space
Volume full / out of space
- Check disk usage:
df -h - Remove unused volumes:
docker volume prune - Increase disk space
- Configure volume size limits
Volume data not persisting
Volume data not persisting
- Verify volume is defined in compose file
- Check mount path is correct
- Ensure volume isn’t being recreated on each deploy
- Inspect volume:
docker volume inspect volume_name
NFS mount issues
NFS mount issues
- Verify NFS server is accessible
- Check firewall rules
- Test mount manually:
mount -t nfs server:/path /mnt - Review NFS server exports:
/etc/exports
Next Steps
Backups
Configure automated volume backups
Databases
Database-specific storage configuration
Multi-Node
Shared storage in multi-node deployments
Monitoring
Monitor storage usage and health