ajayramesh
ajayramesh

Reputation: 3774

How do I migrate docker container from one machine to another machine?

Say I am running a Docker container on my personal computer, I want to migrate that container to my friend machine. The problem here is - the container is running an infinite loop program, I don’t want to kill that program. Instead, I want to pause the container, zip the container then send to my friend system.

This is possible using a virtual machine. Pause the virtual machine, zip the files and then ship to where ever you want. How to do the same in Docker?

Please correct me if I am wrong - I think it is possible to pause a docker container and then move that container to another machine. If so, please tell me how?

Upvotes: 4

Views: 7282

Answers (1)

fg78nc
fg78nc

Reputation: 5232

It is quite possible. Pause current container, export image with docker export container_id -o my_container.tar (this is possible with paused instance) to a TAR-file. , copy the file, import it with docker import containerid -o my_container.tar then just start a new container with docker run on new machine. You can get container id with docker ps.

Upvotes: 10

Related Questions