如何在不同的主机之间移动docker容器 [英] How to move docker containers between different hosts
问题描述
我找不到一种移动码头服务器将一个主机运行到另一个主机的方法。
I cannot find a way of moving docker running containers from one host to another.
有没有办法将我的容器推送回我们这样做图片 ?
目前我没有使用数据卷来存储与在容器内运行的应用程序相关联的数据。因此,一些数据位于容器中,我想在重新设计设置之前要保留。
Is there any way I can push my containers to repos like we do it for images ? Currently I am not using data volumes to store the data associated with applications running inside containers. So some data resides inside containers which I want to persist before redesigning the setup.
任何帮助都不胜感激。
推荐答案
您不能将运行中的Docker容器从一个主机移动到另一个主机。
You cannot move a running docker container from one host to another.
您可以将容器中的更改提交到图像使用 docker commit
,将图像移动到新的主机上,然后使用 docker run
启动一个新的容器。这将保留应用程序在容器内创建的任何数据。
You can commit the changes in your container to an image with docker commit
, move the image onto a new host, and then start a new container with docker run
. This will preserve any data that your application has created inside the container.
这篇关于如何在不同的主机之间移动docker容器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!