Following commands can be used to transfer a docker image from one host to another.
Docker save – Exports an image to tar archive.
Docker load – Loads an image from a tar archive.
Let’s look at an example. To transfer opengrok image from host A to host B
On Host A
# Making sure the image is present on host A.
$docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
opengrok/docker 1.7 625186e069ff 2 days ago 1.25GB
# Saving the image in opengrok.tar archive.
$docker save -o opengrok.tar opengrok/docker:1.7
After copying the tar file to Host B
On Host B
# Loading the image to host B from the opengrok.tar archive.
$docker load < opengrok.tar
e2c6ff462357: Loading layer [==================================================>] 119.3MB/119.3MB
26270c5e25fa: Loading layer [==================================================>] 17.18MB/17.18MB
a42439ce9650: Loading layer [==================================================>] 17.87MB/17.87MB
5d5962699bd5: Loading layer [==================================================>] 150MB/150MB
26863b4714ee: Loading layer [==================================================>] 11.54MB/11.54MB
e8ef11c449dc: Loading layer [==================================================>] 3.584kB/3.584kB
62594f5bf6e3: Loading layer [==================================================>] 342.8MB/342.8MB
fd5cdcd028d3: Loading layer [==================================================>] 3.072kB/3.072kB
2e7813a6682c: Loading layer [==================================================>] 20.83MB/20.83MB
2ab0da063bdf: Loading layer [==================================================>] 2.048kB/2.048kB
081a7de0d0cd: Loading layer [==================================================>] 396.4MB/396.4MB
c7b7bdb42b71: Loading layer [==================================================>] 17.6MB/17.6MB
d8bae3570cdd: Loading layer [==================================================>] 78.77MB/78.77MB
9238077fca33: Loading layer [==================================================>] 82.15MB/82.15MB
e74f3f1d08f5: Loading layer [==================================================>] 8.301MB/8.301MB
c9e6f27955ee: Loading layer [==================================================>] 5.08MB/5.08MB
f8a28f739551: Loading layer [==================================================>] 6.144kB/6.144kB
dbf6f487cd61: Loading layer [==================================================>] 10.75kB/10.75kB
22211226cd23: Loading layer [==================================================>] 32.77kB/32.77kB
c2332486ff50: Loading layer [==================================================>] 13.31kB/13.31kB
Loaded image: opengrok/docker:1.7
# The opengrok image is ready for use on host B.
$docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
opengrok/docker 1.7 625186e069ff 2 days ago 1.25GB