The blog about containerisation, virtual machines and useful shell snippets and findings

Copy docker image to remote host via ssh

It’s common task when you do not want to expose your image via docker hub, but just to deploy it to remote host.

In this case you can use this beautiful oneliner

docker save myimage | ssh -C user@host docker load

That will transfer image to remote host via ssh with compression and loads into docker. In case the same image exists it renames old image and places new one with specified name.

Cool!

Anyway, it will transfer all bunch of layers, instead using registry will definitely save you much bandwidth.