Docker Community Forums

Share and learn in the Docker community.

Create two user facing web service on same node


(Jvuillermet) #1

I think I’m doing something really easy but I can’t find a way to have to service being exposed on port 80 so I can point my dns service to them.

I successfully create one service exposing port 80 but of course, the second one cant be on port 80 as well.
I would guess I need some kind of load balancer but I’m stuck here.

All the guide about load balancing and proxies explain how to load balance the same service.
What should I do or search ?


(Peterlauri) #2

You can easily do this with HAproxy. Create the HAproxy service, and link the two web services from HAproxy. You will create a VIRTUAL_HOST environemtn variable in your two web services, that has unique domain name. If you only will serve on port 80 (http), then you can for example have:

Service1:

VIRTUAL_HOST: http://domain1.com

Serivice2:

VIRTUAL_HOST: http://domain2.com

See more about this at:


https://docs.docker.com/docker-cloud/tutorials/load-balance-hello-world/