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

You will need to save the Docker image as a tar file:

docker save -o <path for generated tar file> <image name>

Then copy your image to a new system with regular file transfer tools such as cp, scp or rsync(preferred for big files). After that you will have to load the image into Docker:

docker load -i <path to image tar file>

PS: You may need to sudo all commands.

EDIT: You should add filename (not just directory) with -o, for example:

docker save -o c:/myfile.tar centos:16

Transferring a Docker image via SSH, bzipping the content on the fly:

docker save <image> | bzip2 | ssh user@host docker load

Note that docker load automatically decompresses images for you. It supports gzip, bzip2 and xz.

It's also a good idea to put pv in the middle of the pipe to see how the transfer is going:

docker save <image> | bzip2 | pv | ssh user@host docker load

(More info about pv: home page, man page).

Important note from @Thomas Steinbach: on high bandwidth, bzip won't be able to compress fast enough. In case you can upload at 10 MB/s and more, gzip/gunzip will be much faster than bzip2.

If you're on 3G and your Internet is slow, @jgmjgm suggests that you can use xz: it offers a higher compression ratio.


To save an image to any file path or shared NFS place see the following example.

Get the image id by doing:

docker images

Say you have an image with id "matrix-data".

Save the image with id:

docker save -o /home/matrix/matrix-data.tar matrix-data

Copy the image from the path to any host. Now import to your local Docker installation using:

docker load -i <path to copied image file>

You can use a one-liner with DOCKER_HOST variable:

docker save app:1.0 | gzip | DOCKER_HOST=ssh://user@remotehost docker load

First save the Docker image to a compressed archive:

docker save <docker image name> | gzip > <docker image name>.tar.gz

Then load the exported image to Docker using the below command:

zcat <docker image name>.tar.gz | docker load