Go to content

geek_stuff/server & linux

How to transfer docker image through ssh

When running multiple dockers on your network, there are times you can push and pull docker images back and forth.

To local image to other external docker service:

docker save name:tag | bzip2 | ssh remote docker load

even for more visual way

docker save imgName:tag | bzip2 | pv | ssh 192.168.0.x docker load

You don't need to save to file and move the file and load the file.

This answer is available in https://stackoverflow.com/questions/23935141/how-to-copy-docker-images-from-one-host-to-another-without-using-a-repository

[How to copy Docker images from one host to another without using a repository

How do I transfer a Docker image from one machine to another one without using a repository, no matter private or public? I create my own image in VirtualBox, and when it is finished I try to depl...


If you need to pull external docker image on the fly and save as file:

ssh 192.168.0.x docker save imgName:latest | pv | gzip > ./imgName_latest.tar.gz

This way, you can save some time to saving images to file, loading file to image.