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 deploy to other machines to have real usage.

Since it is based on my own based image (like Red Hat Linux), it cannot be recreated from a Dockerfile. My dockerfile isn’t easily portable.

Are there simple commands I can use? Or another solution?



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.

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

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


  • 54

    This is the better answer for images.

    – Andy

    May 29, 2014 at 20:18

  • 68

    also, it is better to use repo:tag as the image reference rather than image id. If you use image id, the loaded image will not retain the tag (and you will have to do another step to tag the image).

    – wisbucky

    Sep 14, 2017 at 21:03

  • 1

    I used the image id instead of the name:tag Now I’m sitting here, loaded the image and have a <none> for REPOSITORY and TAG. What is the right way to bring the name and tag back? @wisbucky

    – Ulfhetnar

    Jan 10, 2018 at 7:37

  • 5

    To tag, first identity the IMAGE ID using docker images, then use docker tag DESIREDIMAGEID mycompany/myreponame. If your image id is 591de551d6e4, you can abbreviate the image id: docker tag 59 mycompany/myreponame

    Aug 15, 2018 at 13:07

  • 1

    @serge not at all, it even has an example where a windows path is used…

    – Redoman

    May 5, 2021 at 11:27


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

docker save <image> | bzip2 | ssh [email protected] 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 [email protected] 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.


  • 21

    When using docker-machine, you can do docker $(docker-machine config mach1) save <image> | docker $(docker-machine config mach2) load to copy images between machines mach1 and mach2.

    Sep 4, 2015 at 12:57

  • 5

    @manojlds eval $(docker-machine env dev) is good for general communication with a single docker host but not to copy between two machines, since this involves two different docker hosts / docker machines.

    Nov 18, 2015 at 15:47

  • 23

    to do this in reverse (remote to local): ssh target_server 'docker save image:latest | bzip2' | pv | bunzip2 | docker load

    Feb 1, 2016 at 22:50

  • 2

    Is there any way to do this when docker requires sudo on the target machine? I tried (without compression) docker save my_img:v1 | ssh -t -t [email protected]_machine sudo docker load. Without the “-t” switch, sudo complains sudo: sorry, you must have a tty to run sudo; with one “-t” it’s the same message because ssh says Pseudo-terminal will not be allocated because stdin is not a terminal. and finally, with two “-t”s, I get the content of the tar file (i.e. the image) on my terminal. Any ideas?

    – hunger

    Dec 14, 2016 at 10:02

  • 1

    @JosefStark I needed to add “Defaults:<target username> !requiretty” when editing the sudoers file to stop the “Sorry” message from sudo. I don’t know how much of a difference it makes but I also put everything after the [email protected] in quotes (so “[…] | ssh [email protected] ‘bunzip2 | sudo docker load'”).

    Jun 15, 2017 at 10:12


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>