Backup & Restore Docker Named Volumes

Backup & Restore Docker Named Volumes

5 years ago
Anonymous $syBn1NGQOq

https://medium.com/@loomchild/backup-restore-docker-named-volumes-350397b8e362

When I was looking for a way to back up Docker named volumes I was surprised to find out that there’s no standard way of handling the process. In the official documentation there’s only a note about using data volume containers and a --volumes-from option. There’s also a docker cp command, but it requires the volume path inside the container that uses them, which makes it less generic.

After a bit of research, it turned out it’s actually pretty easy to back up volumes using volume mounts and a tar utility. For example to backup some_volume to /tmp/some_archive.tar.bz2, you can simply run: