是否可以使用单个docker撰写文件在多个主机中创建容器? [英] Is it possible to create container in multiple host using a single docker compose file?

查看:190
本文介绍了是否可以使用单个docker撰写文件在多个主机中创建容器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须在多个主机中创建容器。我有一个dockerfile为每个容器。我发现docker-compose可以用于从单个yaml文件运行多个容器。我必须在HostA中运行containerA,在HostB中运行containerB等等。可以使用docker-compose来实现这一点吗?或者使用dockerfile在不同主机中创建容器的最佳方式是什么。

解决方案

不,docker-compose alone不会实现这一点跨多个主机管理容器通常是调度程序的工作。 Docker生态系统:计划和编排是一个较旧的文章,但应该介绍。



Docker提供的调度程序称为Swarm。 使用组合与群组是开始了解如何一起使用的好地方。 / p>




这部分答案是时间有限的,但在导师周有几个免费课程可以用来了解更多关于Swarm的信息。在您的情况下,操作初学者和中级可能很有趣。


I have to create containers in multiple host. I have a dockerfile for each container. I found that docker-compose can be used to run multiple containers from a single yaml file. I have to run containerA in HostA, containerB in HostB and so on.. is it possible to achieve this using docker-compose ? or what is the best way to create container in different host using the dockerfile.

解决方案

No, docker-compose alone won't achieve this. Managing containers across multiple hosts is generally the job of schedulers. The Docker Ecosystem: Scheduling and Orchestration is an older article, but should give an introduction.

The scheduler provided by Docker is called Swarm. Use Compose with Swarm is a good place to start to understand how to use them together.


This part of the answer is time limited, but during Mentor Week there are a few free courses you can take to learn more about Swarm. In your case Operations Beginner and Intermediate may be interesting.

这篇关于是否可以使用单个docker撰写文件在多个主机中创建容器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆