Back up a Docker volume to a tar archive
how to backup docker volume | docker volume to tar.gz | export docker volume data | docker | volumes | backup | tarCaution: This command changes the system. Understand what it does before you run it.
docker run --rm -v app_data:/data:ro -v /root/docker-backup:/backup alpine tar czf /backup/app_data.tar.gz -C /data .Starts a short-lived Alpine container that mounts the volume read-only under /data and the host target directory under /backup, and packs the contents with tar. The helper container is removed automatically afterwards. The volume name is listed in docker volume ls, with Compose usually prefixed by the project name.
Note: For a consistent backup of databases, stop the associated container first or, better, create a dump. An archive with the same name in the target is overwritten, and on the first run the alpine image is downloaded.
Also searched as
- how to backup docker volume
- docker volume to tar.gz
- export docker volume data