How to copy docker volume from one machine to another?

I have created a docker volume for postgres on my local machine.

docker create volume postgres-data

Then I used this volume and run a docker.

  • Programmatically setting Flash security in Linux
  • Docker environmental variables as calculated parameters
  • How to email from WordPress in Docker container?
  • Docker runs out of disk space even though containers are small
  • Start kdc in Dockerfile
  • How to currectly create Virtual Switch in Windows Server 2016 TP4 while installing Docker? (not boot2docker)
  • docker run -it -v postgres-data:/var/lib/postgresql/9.6/main postgres

    After that I did some database operations which got stored automatically in postgres-data. Now I want to copy that volume from my local machine to another remote machine. How to do the same.

    Note – Database size is very large

  • Using a unique-hosted data volume containers with v3 in swarm
  • Using host env variable with docker remote API
  • Redmine: Docker failures
  • How to use Nomad with Nvidia Docker?
  • Syn flood and net.ipv4.tcp_syncookies
  • Nvidia Theano docker image not available
  • One Solution collect form web for “How to copy docker volume from one machine to another?”

    If the second machine has SSH enabled you can use an Alpine container on the first machine to map the volume, bundle it up and send it to the second machine.

    That would look like this:

    docker run --rm -v <SOURCE_DATA_VOLUME_NAME>:/from alpine ash -c "cd /from ; tar -cf - . " | ssh <TARGET_HOST> 'docker run --rm -i -v <TARGET_DATA_VOLUME_NAME>:/to alpine ash -c "cd /to ; tar -xpvf - " 

    You will need to change:


    Or, you could try using this helper script

    Hope this helps.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.