CloudLinux.ro
Docker & containers

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 pricing

Related tutorials