Docker Community Forums

Share and learn in the Docker community.

Copy data from docker volume mount - backup/restore

I’m moving from macOS to Windows 10 with docker, i got issue when i try to work with MongoDB where i normal use a data folder mount and not a folder inside Docker and that what i want to do now just a docker mount volume.

the problem i have now, how can i take backup from a docker volume and then out to the windows folder and if i need to restore, how can i restore the data back to a docker volume folder inside my container?

hope i can get a little help here?

i have found the way to copy the data out, but now i just need to copy it in agin, my backup command is

docker cp {container}:{path} .

You should create a tar file of the whole volume and then restore it on the new system. Take a look at the section Backup, restore, or migrate data volumes in the documentation for volumes.


from the mac machine you can commit the container as image
and push this to registry.
since you mention that cp of folder is done and this can be restore
or new machine just pull the image again with name which was commited.


i think its what i need, i will try it out , :slight_smile: for now i just backup my mongo db and restore it agin, but i need to play around with this backup/restore technics, thanks a lot for your time :slight_smile:

i don’t want to push to registry, i just want to take backup of the data inside a volume, and restore it later, first idea was to create a mount to the host folder, but windows and linux file system is not the same so i got issues with mongodb, thats why i need to copy the files from a volume out and in agin, so i don’t need to use mongodump and mongorestore but thats what i do right now :slight_smile:

Hi, I need to copy the volume directly to s3 and copy and restore it to another host without creating a tar file of volume due to time constraints. do we have some way?