This gist includes config for haproxy + docker-gen system with routing http requests to different containers based on hostname label.
- docker-engine
- docker-gen ( https://github.com/jwilder/docker-gen )
- haproxy ( current setup uses debian packaged service )
- put haproxy.tmpl to /etc/haproxy/haproxy.tmpl and docker-gen.cfg to /etc/docker-gen.cfg
- run
docker-gen -config /etc/docker-gen.cfg
to start the system - run containers with
hostname
label e.g.docker run --label hostname=foo.example.com nginx
- put docker-gen.service to /etc/systemd/system/docker-gen.service
- enable service with
systemctl enable docker-gen
- start docker-gen service with
service docker-gen start