Multiple different container all listening on the same host machine

Hi, i request your help here because i’m in front of a big trouble :

I have 2 services defined in my docker-compose.yml which are typically two website (i’ll call them web1 and web2) web1 need web2 to work.

I WANT to be able to call web1 via web1.local (hostname pointing on and to call web2 via web2.local (hostname pointing on

I DON’T WANT to be obliged to call web1 via web1.local (hostname pointing on and to call web2 via web1.local:8080 (hostname pointing on

I’m also getting crazy with different network configuration and frustrated by the fact that a simple apache server can make it work but not Docker …

I’ll be thanksfull you give me some help.


no can do… only ONE application can use a port at the same time.

you could use a something like apache or nginx to route a PATH and
but you have to provide some different input to select the other app

docker does NOT provide ANY data routing… that is some other apps responsibility

Thanks … pretty boring that this is not possible …

It’s possible. Just have to use some additional software. You could NOT map the ports on to the host and access by ip address (which is what apache or nginx would do)

OK, well but what if ip has changed, which could be done randomly on docker …

You can set the IP on the docker run to control that. Docker create a network, and then use that and IP address parms

Hi, I got the same problem and solved it with traefik.
I did a reminder here - in [fr] sorry - (stuff with docker4php from Maybe it’ll help ^-^