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 –
- Commit it
- 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
- It will copy the image on the given location. In the above example, it will be “d:\temp\images”.
- Now copy the above newly exported image to the target windows 2016 server.
- 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”
- 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.
- 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
It will create the container. You can get the list of running containers using the command – docker container ls
——-End Of Article—–