docker-archive / dockercloud-haproxy

HAproxy image that autoreconfigures itself when used in Docker Cloud
https://cloud.docker.com/
651 stars 187 forks source link

Multiple services in one container #159

Closed dhessmann closed 7 years ago

dhessmann commented 7 years ago

Hi everyone,

i'm starting one container with multiple services on different ports in it. Example: Two webservers, on on port 80 on on port 8080. They serve different functions. How can i add them so that both are reachabel under their port without having haproxy balance load between them.

I have tried something like this: -e VIRTUAL_HOST="app.docker-dev.example.com, app.docker-dev.example.com:8080" \ -e SERVICE_PORTS="80, 8080" \

Is there a way to get this working? I don't want to build multiple images for each service.

Grettings Dominik

tifayuki commented 7 years ago

you can use HTTP load balancing for one port and TCP load balancing for the other port: -e VIRTUAL_HOST="https://app.docker-dev.example.com" -e SERVICE_PORTS="80, 8080" -e TCP_PORTS="8080"

ash9002 commented 7 years ago

Can a similar configuration be used for Swarm Mode?

tifayuki commented 7 years ago

@ash9002 yes, it works with and without swarm mode