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

In my article on docker container (, 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—–

Docker–Windows Server 2016

Requirement is to understand how to deploy IIS based website in the container.

To play around, create a Windows Server 2016 based VM in MS Azure.

Steps to follow –

  1. Configure Docker environment in Windows Server 2016:

            Run the below commands –

      • Install-PackageProvider -Name NuGet -MinimumVersion -Force
      • Install-Module -Name DockerMsftProvider –Force
      • Install-Package -Name docker -ProviderName DockerMsftProvider -Force
      • Restart-Computer –Force


        2.   To verify, it it is installed correctly, Run the command –

              docker version 



        3. Next step is to pull the IIS image from docker secured registry. Run the below command –

            docker pull Microsoft/iis

            This command will take some time to pull and extract the IIS image onto the server. Once completed successfully, run the command “docker images” to list the images pulled from DSR.




     4. Run the following command to start the container –

         docker run –d –name myFirstIIS –p 80:80 microsoft/iis

     5. Run the following command to list all the running containers –

         docker ps –a


         docker container ls

     6. Run the following command to open the command prompt inside the container – docker exec –I myFirstIIS cmd

     7. Write index.html in the inetpub of the IIS in the container as –

      echo "Hello World From a Windows Server Container" > C:\inetpub\wwwroot\index.html


     7. Browse the IIS site as shown below –



All the steps above can be done through DockerFile concept. I will explain it in the next article.


                  ——End of the Article—–