5 Elements: Docker, Registrator, Consul, Consul Template, Nginx
Tools
- Gliderlabs Consul / server
- Gliderlabs Registrator
- Hashicorp Consul Template or Confd tool
- ziyasal confroxy image that contains nginx and consul template
Other Alternative
Another way to do that listen docker events manually (for example: node-docker-monitor)
and register or deregister services from consul then update your proxy tool (for example: node-http-proxy)
docker run -it -h node \
-p 8500:8500 \
-p 8600:53/udp \
gliderlabs/consul-server \
-server \
-bootstrap \
-advertise localhost \
-log-level debug
docker run -d \
--name=registrator \
--net=host \
--volume=/var/run/docker.sock:/tmp/docker.sock \
gliderlabs/registrator:latest \
consul://localhost:8500
docker run -it --net=host -e "CONSUL=127.0.0.1:8500" -e "SERVICE=trex-svc" -p 80:80 confroxy
docker build -t trex/server .
docker service scale trex=3
will do that if you like to try new stuff (:
stating services manually
docker run -it -e "SERVICE=trex-svc" -p 8000:80 trex/server
docker run -it -e "SERVICE=trex-svc" -p 8001:80 trex/server
docker run -it -e "SERVICE=trex-svc" -p 8002:80 trex/server