How to transfer a docker container from one computer to another?
Let's say I am running a Docker container on my personal computer, I want to transfer this container to my friends machine. The problem here is that there is an infinite loop program running in the container, I don't want to kill this program. Instead, I want to pause the container, freeze the container, and then send friends to my system.
This is possible using a virtual machine. Pause the virtual machine, write the files and send wherever you want. How do I 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 yes, please tell me how?
source to share
That's quite possible. Suspend the current container, export the image using docker export container_id -o my_container.tar
(it is possible with a suspended instance) to a TAR file, copy the file, import it using docker import containerid -o my_container.tar
, and then start a new container with docker run
on a new computer. You can get the container id from docker ps
.
source to share