How to back up Docker containers and volumes
Updated 7/20/2026
Containers are easy to recreate from images, but the data in volumes is what matters. Here is how to save it.
1. Back up a volume
Run a temporary container that archives the volume:
docker run --rm -v app_data:/data -v $(pwd):/backup alpine \
tar czf /backup/app_data.tar.gz -C /data .
2. Restore
docker run --rm -v app_data:/data -v $(pwd):/backup alpine \
tar xzf /backup/app_data.tar.gz -C /data
3. Save the configuration too
Keep the compose.yaml and .env files in git or a separate backup. With those plus the volumes, you can rebuild everything.
4. Send the backup off the server
A backup on the same server does not help if the server fails. Copy the archives to a Backup Box, mounted as an extra disk:
rsync -a app_data.tar.gz /mnt/backup/docker/
5. Automate
Put the backup script in cron, see automated backups with cron.
Put this guide into practice on your own VPS
EU cloud servers, billed hourly, ready in minutes, with one-click installs for dozens of apps.
See pricingRelated tutorials
How to free up disk space used by Docker
Images, stopped containers and orphaned volumes can fill your disk. Here is how to clean them up safely.
Updated 7/20/2026Docker & containersHow to run your own private Docker registry
Host your own Docker images on a private server, without depending on external services.
Updated 7/20/2026Docker & containersDocker security best practices
Run safer containers: non-root users, official images, limited resources and protected secrets.
Updated 7/20/2026