将Docker容器移至新服务器

发布于 2025-02-11 03:36:29 字数 392 浏览 2 评论 0原文

我已经升级到新服务器,并试图迁移我的Docker容器。 我正在运行的大多数容器由多个图像文件组成,

使用了docker comm

Docker保存Image1 Image2 Image2 Image3> backup.tar

然后将焦油文件传输到我的新服务器并运行 docker load -i backup.tar

将备份图像添加到我的新服务器上的相关卷中,

我现在遇到的问题是,有7个图像文件,我找不到方法使用这些图像文件创建Docker容器。

当我使用YAML文件并更改图像以表示本地存储的图像而不是来自Docker存储库的图像时,它仍然从存储库中拉出

图像文件?

I have upgraded to a new server and am trying to migrate my Docker containers over.
Most of the containers that I am running are made up of multiple image files

I used the docker commit appID appname command to create my own images of each

and then saved all of the images to a .tar file using
docker save image1 image2 image3 > backup.tar

Then transfered the tar file to my new server and ran
docker load -i backup.tar

Which added the backup images as wel as associated volumes on to my new server...

The problem I now have is, there are 7 image files and I cannot find a way to create the docker container using these image files.

When I use the YAML file and change the image to represent the locally stored image rather than the image from the docker repository, it still pulls the image from the repository

Is there a recommended way to launch the container from the local images exported from the tar file?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

烙印 2025-02-18 03:36:29

也许您可以使用类似的东西:

docker save -o backup.tar $(docker images --format "{{.Repository}}:{{.Tag}}")

另外:

 docker save $(docker images --format "{{.Repository}}:{{.Tag}}") > backup.tar

这将用名称和标签标记您的图像。

一旦您执行

docker load -i backup.tar

并执行:

docker images -a

您将能够根据名称使用图像:TAG

Maybe you can use something like this:

docker save -o backup.tar $(docker images --format "{{.Repository}}:{{.Tag}}")

Alternatively:

 docker save $(docker images --format "{{.Repository}}:{{.Tag}}") > backup.tar

This will tag your images with the name and tags.

Once you do

docker load -i backup.tar

and perform:

docker images -a

you will be able to use the images based on the name:tag

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文