简体   繁体   English

导出 docker-compose 容器

[英]Exporting a docker-compose container

I used docker-compose to create an app that is composed by three images.我使用 docker-compose 创建了一个由三个图像组成的应用程序。 I would like to understand now how can I export this app with the all services included.我现在想了解如何导出包含所有服务的应用程序。

Just for clarification the containers and images are the following:只是为了澄清容器和图像如下:

container ls -a
CONTAINER ID   IMAGE
82522c850e9c   docker-app_client
7c796b6629bb   docker-app_server
66c84b58da2b   mongo

docker images
docker-mice-tracking-app_server
docker-mice-tracking-app_client
mongo

I can start my application from the folder in which i build the docker images by typing docker-compose up .我可以通过键入docker-compose up从我构建 docker 图像的文件夹启动我的应用程序。

How can I export this images and replicate the same behavior on a different machine?如何导出此图像并在不同的机器上复制相同的行为?

Thank you.谢谢你。

Couple of ways here.这里有几种方法。

  1. Store all images in a docker registry.将所有图像存储在 docker 注册表中。 For this you need to tag and push the images.为此,您需要标记和推送图像。 Once you have that done , copy over the compose file to the new machine and run the docker-compose up .完成后,将撰写文件复制到新机器并运行docker-compose up Note that you will have to change the image name on your compose to reflect the images you had retagged in order to be able to pull them down.请注意,您必须更改撰写上的图像名称以反映您重新标记的图像,以便能够将它们下拉。

  2. If you do not have access to a docker registry , you can save the docker images using a docker save command which will create a tar file of those images.如果您无权访问 docker 注册表,则可以使用docker save命令保存 docker 图像,该命令将创建这些图像的 tar 文件。 Copy those tar files over to a new system and do a docker load to load them as images from the tar file.将这些 tar 文件复制到新系统并执行docker load以将它们作为图像从 tar 文件加载。 Once done , you can run the docker compose command to deploy them on the new system完成后,您可以运行 docker compose 命令将它们部署到新系统上。

I think you can push your images onto a docker registry by using我认为您可以通过使用将图像推送到 docker 注册表

docker push

Then from other machines, you pull the images and run it.然后从其他机器上提取图像并运行它。

The documentation is here文档在这里

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM