Ease development with Docker by routing requests to your development domains to the right container, similarly to virtual hosts in Apache and NGINX.
- Create a docker network named proxy:
docker network create proxy
- Run docker-haproxy with
docker-compose up
- Add
VIRTUAL_HOST
environment variable to your container/service with your desired domain name (e.g. test.dev) - Add your domain name to your hosts file and point it to
127.0.0.1
or use dnsmasq route your whole TLD (e.g. .dev) to127.0.0.1
. - Start your container/service and browse to your domain, voilà.
Note: docker-haproxy only needs to be started once! After that it will automatically start whenever your docker daemon is started, even after a reboot. To stop docker-haproxy simply run docker-compose stop
.
- HAProxy
- Docker-Gen by Jason Wilder
- Maarten de Boer ([email protected])
BSD-2-Clause license, see LICENSE