Reputation: 2606
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.
Upvotes: 2
Views: 1782
Reputation: 1324657
If you are using a reverse proxy, (like an NGiNX), that means both your Apache servers must run on ports different from 80.
Only your NGiNX would run (on host directly for instance) on port 80, and would redirect to localhost_apache1:xxx
and 172.17.0.2_apache2:yyy
.
From the user perspective, both Apache would be seen "as if" they were running on port 80 themselves.
Upvotes: 1