The Essential Guide To Moving Docker Containers

Docker provides various commands/methods for moving containers. Within this article we will look at each of the commands, along with examples needed to move your Docker containers between your hosts and repositories.

Repo to Repo

Lets look at how we get an image from a repository and how we get our local image up to a remote repository.


The docker pull command is used to  pull an image from a repository.

$ docker pull busybox
Using default tag: latest
latest: Pulling from library/busybox
Digest: sha256:29f5d56d12684887bdfa50dcd29fc31eea4aaf4ad3bec43daf19026a7ce69912
Status: Image is up to date for busybox:latest

Tip Docker will pull from by default. To pull from another repo add the hostname of your registry to the docker pull command, i.e docker pull [1]


To move images from repository to repository docker push is used. Below shows the steps in involved in pushing an image to a repository,

  1. Authenticate – If required by the repository, authentication is performed with the docker login command.
  2. Tag – Next the repository and a tag is supplied to the docker tag command.
  3. Push – Finally docker push is used to push the image to the repository.

Here is an example,

$ docker login
Username: felix001
Login Succeeded

// TAG
$ docker tag busybox

$ docker push
The push refers to a repository [] (len: 1)  
Sending image list  
Pushing repository (1 tags)  
d3a1f33e8a5a: Image successfully pushed  
c22013c84729: Image successfully pushed  
d74508fb6632: Image successfully pushed  
91e54dfb1179: Image successfully pushed  
Pushing tag for rev [91e54dfb1179] on {}

Host to Host

With host to host, we can take a local image or container and then load (or import) it to another docker environment.

Export vs Save

Ok, so lets look at the docker export and docker save commands,

docker export saves the running or paused instance [2] of a CONTAINER to a TAR-file.
docker save saves an IMAGE to a TAR-file.

Below is an example of both,


$ docker ps
CONTAINER ID        IMAGE               COMMAND 
5e8f397be6fa        busybox             "sh"   

$ docker export 5e8f397be6fa -o busybox-container.tar


$ docker images
REPOSITORY                            TAG                 IMAGE ID
busybox                               latest              e02e811dd08f

$ docker save -o busybox-image.tar busybox

Import vs Load

Finally the commands docker import and docker load are used inline with the TAR-file previous created. So

docker import is used to import a TAR-file (i.e CONTAINER) created by a docker export
docker load is used to load a TAR-file (i.e IMAGE) created by a docker save

$ docker import busybox-container.tar

$ docker load --input busybox-image.tar
Loaded image: busybox:latest



Rick Donato

Want to become a Docker and Kubernetes expert?

Here is our hand-picked selection of the best courses you can find online:
Docker Mastery course
Kubernetes Mastery course
and our recommended certification practice exams:
AlphaPrep Practice Tests - Free Trial