Skip to content

How to Move Docker Images between Hosts

How to Move Docker Images between Hosts. This tutorial will help you to export and import Docker images and move them between hosts.

Covers
Docker
Versions & support
About Docker →
On this page

In our previous tutorials you have learned about installation of Docker engine on CentOS/RHEL and Ubuntu operating system and pulled images from Docker hub. After that created containers with images. This tutorial will help you to export and import Docker images and move them between hosts.

List Docker Images

Fist list docker images on your system using below command.

root@tecadmin:~# docker images

REPOSITORY     TAG        IMAGE ID            CREATED          VIRTUAL SIZE
centos         latest     2933d50b9f77        11 days ago      196.6 MB
ubuntu         latest     36248ae4a9ac        11 days ago      188 MB

Save or Archive Image

Now use the following command to save image repository named ubuntu (image id: 36248ae4a9ac) and make a zipped archive named ubuntu-latest.tar.gz. Remember that save is used for making backup of docker images (not containers).

# docker save ubuntu | gzip > ubuntu-latest.tar.gz

Import Image

After saving docker image in archive format on your system move it to remote system using scp or ftp. After that use below command on remote system to import Docker image with name ubuntu and tag name latest.

# zcat ubuntu-latest.gz | docker import - ubuntu:latest

The above command will create a docker image with name ubuntu and tag name latest on your system. You can now launch containers using this image like below.

# docker run -i -t ubuntu /bin/bash

Rahul

Rahul Kumar is the founder and chief editor of TecAdmin.net. A Red Hat Certified Engineer (RHCE), he has worked in IT since 2009, with hands-on experience in Linux system administration, DevOps, web hosting, cloud platforms and automation. He started TecAdmin in 2013 to share practical, step-by-step guides, and leads its editorial work with one aim: making technical learning clear and useful for sysadmins, developers and beginners alike.

1 Comment

Leave a Reply

Your email address will not be published. Required fields are marked *


Back to top