4

I am trying to backup the data of a mysql docker container volume. I found this post, but it didn't work for me yet. I use git bash, so I can use unix tools.

The problem is, I cannot access the volume data, which is on the docker VM (disk image location is C:\Users\Public\Documents\Hyper-V\Virtual Hard Disks\DockerDesktop.vhdx).

I tried

docker run --rm --volumes-from mysql_1 -v /$(pwd):/backup busybox tar cvf ./backup/backup_sql.tar /var/lib/docker/volumes/<some hash>/_data`. 

which exited with error

tar: C:/Program Files/Git/var/lib/docker/volumes/<some hash>/_data: No such file or directory
tar: error exit delayed from previous errors

/var/lib/docker/volumes/<some hash>/_data is the Source of the mounted volume as given by command docker inspect mysql_1.

An empty tar file ./backup_sql.tar was created.

Has anyone succeeded doing a backup and restore of a docker volume with docker for windows and is willing to share?

emi-le
  • 756
  • 9
  • 26

1 Answers1

0

For this command use cmd with the following command:

docker run --rm --volumes-from mysql_1 -v %cd%:/backup busybox tar cvf ./backup/backup_sql.tar /var/lib/docker/volumes/<some hash>/_data`. 
t4t5u
  • 1