Docker Community Forums

Share and learn in the Docker community.

Run apache in both host machine and docker container on 80 port

docker

(Kuldeepk) #1

I need to setup something like automated server setup using docker. Now server machine should support both docker or normal setups. So I need to setup apache web server on both docker container and host machine on 80 port. Like

Host Machine  : application1.serverhost.com
Docker Machine  : application2.serverdocker.com

But Docker will not utilize 80 port as it is already bind on host machine apache. While I am thinking of use reverse proxy on host machine with apache like

Proxy Setting -> 172.17.0.2:8080 

while on browser connect to proxy application2.serverdocker.com on 80 port. IP -> 172.17.0.2 is docker container IP which I am thinking to get from docker inspect.

But if any other way to handle this in docker itself where I can ignore reverse proxy on host machine. And call both application1.serverhost.com and application2.serverdocker.com from browser without appending port.

EDIT : One big issue using reverse proxy is that whenever I need to add another docker on same server I need to add also proxy for that new IP too as that would also running docker apache on other port like 8081 than Host port:80 and first docker’s port:8080. In other words lot of reverse proxy settings and ports in case of lot of docker instances.