如何在不同机器上运行码头容器 [英] How to run docker containers on different machines
问题描述
- 容器为mysql
- 应用程序服务器容器(tomcat7)
- 容器for nginx
- 容器for python龙卷风应用程序
在本地机器上,使用 docker-machine
,我已经尝试了所有这些容器和它们之间的互动。我用boot2linux创建了一个虚拟机,并在其上设置所有这些容器。
现在,对于生产,我将在单独的服务器上运行这些容器中的每一个。 Docker有什么可以快速/轻松地做到这一点吗?或者我应该在每个服务器上设置Docker,将相关图像复制到该服务器,然后在所有服务器上手动启动docker-images?
或者我应该在每个服务器上设置docker,将相关图像复制到该服务器,然后在所有服务器上手动启动docker-images?
是的,但您也应该:
- 创建
然后,您可以在计算机上创建容器。
请参阅了解Docker容器网络
I've setup several docker containers for my application:
- container for mysql
- container for application server (tomcat7)
- container for nginx
- container for python tornado application
On my local machine, using
docker-machine
, I've tried all these containers and them interactive with each other. I created one virtualbox machine with boot2linux and setup all these containers on it.Now, for production I am going to run each one of these containers on a separate server. Is there something docker provides to quickly/easily do this? Or should I set up docker on each server, copy relevant images to that server, and then start docker-images manually on all servers?
解决方案Or should I set up docker on each server, copy relevant images to that server, and then start docker-images manually on all servers?
Yes, but you should also:
- create the relevant libnetworks in order for your containers to be registered in them
- create as first container a KV one (Key-Value: Consul, etcd, Zookeeper, ...) that will monitor each containers in each network(/machine), allowing them to see each others.
Note: you might want to use a docker 1.10 for adding a network-scoped alias to your containers.
Then you can create your containers on your machines.
See a practical example at Understand Docker container networks
这篇关于如何在不同机器上运行码头容器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!