0

I've been using a Linux host machine with several docker containers running with one of those as Nginx Proxy Manager (from now on: NPM), which is just Nginx with a friendly UI.

NPM exposes ports 80 and 443 and redirects traffic to each container as per the proxy rules specified, a regular old reverse proxy configuration. All containers are instructed to connect to a bridge Docker network so NPM can easily reach them.

All of that works. Now I have a new service that needs to be exposed using NPM as well, the difference is that the service does not run on a container but rather in the host machine, and it is reachable at port 3711.

By doing my research and ended up with this suggestion:

extra_hosts:
    - "host.docker.internal:host-gateway"

By adding that to the docker-compose file under the NPM service, you allow it to reach any port on the host machine, and in fact by doing a ping from within the NPM container to host.docker.internal I got an answer. The problem is that after setting up the proxy rule, like I always do:

enter image description here

If I try to reach the service from the internet by ci-server.domain.com, I got a 502. BUT if I do ci-server.domain.com:3711 I can reach it!

Why Do I need to add the internal port to the domain? All my other services running on containers respond to 80/443 and get redirected internally to their ports.

DomingoSL
  • 14,920
  • 24
  • 99
  • 173

0 Answers0