0

I need to copy docker's data volume from Mac to Windows. I've already got the tgz file with volume from Mac, then I create an alpine container, and check /var/lib/docker folder on Windows 10 as I did it on Mac.

What I see is that /var/lib folder is empty on my Windows 10.

enter image description here

How could I access the folder with volumes on Windows to copy mine there?

Vitalii
  • 10,091
  • 18
  • 83
  • 151

1 Answers1

0

Here's how you can add a volume to Windows docker manually:

First step is to create the volume with the same name as you have in your tar backup file: docker volume create myvolume

Next, you need to run a simple image and mount there docker volumes folder and some folder on this image. You also need to mount some windows folder with a folder in your container to be able to copy your image to container.

docker run --rm -it -v /var/lib/docker/volumes:/volumes -v c:/temp:/windows alpine

  • -v /var/lib/docker/volumes:/volumes - mounts a docker's volumes folder to a folder in your container
  • c:/temp:/windows - mounts a c:/temp folder on your windows with a folder windows in your container

All you need to do after is just copy your volume inside a container from windows to volumes cp /windows/myvolume /volumes -r

For Docker on Windows to make folder sharing work don't forget to enable shared drive in settings enter image description here

Vitalii
  • 10,091
  • 18
  • 83
  • 151