问题
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?
回答1:
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
来源:https://stackoverflow.com/questions/34938674/how-to-run-docker-containers-on-different-machines