Docker–How to move container from one Windows host to another


In my article on docker container (https://mdaslam.wordpress.com/2017/05/24/windows-server-2016-docker-container-dockerfile/), I described how to create docker container.

Now docker container is created and you want to migrate/copy it from one windows server machine/host to another.

You cannot copy the running container from one host to another, rather you need to follow the following steps –

  1. Commit it
  2. Export the docker image to the local drive using the command – docker save –o <Path of the output file location> <Image ID or Name> Example – docker save –o “d:\temp\images\dotnetsamples” d242f2db7922
  3. It will copy the image on the given location. In the above example, it will be “d:\temp\images”.
  4. Now copy the above newly exported image to the target windows 2016 server.
  5. Once copied there successfully, load it onto that server using the command – docker load –i <Path of the output file location> Example – docker load –i “d:\temp\images\dotnetsamples”
  6. On the successful execution of the above command, image will be restored successfully. To verify it, run the command – docker images and it should display the imported image name in the results.
  7. Finally, Once image is created successfully, we need to create the container. It can be created using the command – docker run -d -p 80:80 [ImageName] ping -t localhost
  8. It will create the container. You can get the list of running containers using the command – docker container ls

               ——-End Of Article—–

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s