[GH-ISSUE #869] Proxy non-docker services #738

Closed
opened 2026-02-26 06:34:12 +03:00 by kerem · 8 comments
Owner

Originally created by @rototom on GitHub (Feb 7, 2021).
Original GitHub issue: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/869

I installed npm and really like this aproach of proxying to my serives.
I have several docker and non-docker services on my server, the docker ones are simple to use via docker-compose and the "network" entry in the docker-compose.yml.
How can I use my non-docker services, funkwhale and mastodon f.e.?

Originally created by @rototom on GitHub (Feb 7, 2021). Original GitHub issue: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/869 I installed npm and really like this aproach of proxying to my serives. I have several docker and non-docker services on my server, the docker ones are simple to use via docker-compose and the "network" entry in the docker-compose.yml. How can I use my non-docker services, funkwhale and mastodon f.e.?
kerem 2026-02-26 06:34:12 +03:00
Author
Owner

@lieven121 commented on GitHub (Feb 11, 2021):

You could easily convert them to docker containers (there are 101 tutorials online)
Or you should be able to refer to the "host" you are running the proxy on to them.
Your First guess might be localhost but this would actually refer to the container itself.

There are several ways to fix this
src
1 use --network="host" this would allow you to use localhost but has other side effect you might not want

2 find the ip of the host. is explained in the src but is kinda a workaround and can change with new deployments

3 (my favorite) host.docker.internal this shoud point to the host. here just add the port of the service

(unless its running on a other server ofc, then its just serverip:port)

<!-- gh-comment-id:777281022 --> @lieven121 commented on GitHub (Feb 11, 2021): You could easily convert them to docker containers (there are 101 tutorials online) Or you should be able to refer to the "host" you are running the proxy on to them. Your First guess might be localhost but this would actually refer to the container itself. There are several ways to fix this [src](https://stackoverflow.com/questions/24319662/from-inside-of-a-docker-container-how-do-i-connect-to-the-localhost-of-the-mach) 1 use --network="host" this would allow you to use localhost but has other side effect you might not want 2 find the ip of the host. is explained in the src but is kinda a workaround and can change with new deployments 3 (my favorite) host.docker.internal this shoud point to the host. here just add the port of the service (unless its running on a other server ofc, then its just serverip:port)
Author
Owner

@Robin-Sch commented on GitHub (Sep 11, 2021):

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

I've added that to proxy manager, and in a different compose project one service is listening on 0.0.0.0:8080. Going to publicIP:8080 works.

docker exec -it proxymanager bash
curl host.docker.internal:8080 -L
curl: (7) Failed to connect to host.docker.internal port 8080: No route to host

I can't put them in the same network because the other compose project requires it's own network

<!-- gh-comment-id:917380140 --> @Robin-Sch commented on GitHub (Sep 11, 2021): ``` extra_hosts: - "host.docker.internal:127.17.0.1" ``` I've added that to proxy manager, and in a different compose project one service is listening on 0.0.0.0:8080. Going to publicIP:8080 works. ``` docker exec -it proxymanager bash curl host.docker.internal:8080 -L curl: (7) Failed to connect to host.docker.internal port 8080: No route to host ``` I can't put them in the same network because the other compose project requires it's own network
Author
Owner

@adrianbienias commented on GitHub (Feb 12, 2023):

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

Inside the container in /etc/hosts, it maps IP 172.17.0.1 to host.docker.internal.

So host.docker.internal is quite irrelevant, what it matters is the IP.

I have an app running on the host on port 3000 (it's not dockerized). I'd like to ultimately proxy that app to a domain.

I'm trying to debug it first, running bash inside the Nginx Proxy Manager container.

So, inside the container, I run curl 172.17.0.1:80. It shows default Nginx Proxy Manager "Congratulations!" page.

But when I try (inside the container) curl 172.17.0.1:3000 it just times out or refuse to connect.

So Nginx Proxy Manager container clearly doesn't have access to the host.

Any ideas what could be the case?

<!-- gh-comment-id:1427007896 --> @adrianbienias commented on GitHub (Feb 12, 2023): ``` extra_hosts: - "host.docker.internal:host-gateway" ``` Inside the container in `/etc/hosts`, it maps IP `172.17.0.1` to `host.docker.internal`. So `host.docker.internal` is quite irrelevant, what it matters is the IP. I have an app running on the host on port 3000 (it's not dockerized). I'd like to ultimately proxy that app to a domain. I'm trying to debug it first, running bash inside the Nginx Proxy Manager container. So, inside the container, I run `curl 172.17.0.1:80`. It shows default Nginx Proxy Manager "Congratulations!" page. But when I try (inside the container) `curl 172.17.0.1:3000` it just times out or refuse to connect. So Nginx Proxy Manager container clearly doesn't have access to the host. Any ideas what could be the case?
Author
Owner

@ycsin commented on GitHub (Sep 2, 2023):

Hey @adrianbienias, I'm also having the same question, did you manage to find a fix for this?

<!-- gh-comment-id:1703790065 --> @ycsin commented on GitHub (Sep 2, 2023): Hey @adrianbienias, I'm also having the same question, did you manage to find a fix for this?
Author
Owner

@adrianbienias commented on GitHub (Sep 2, 2023):

@ycsin I ended up using the following docker compose configuration:

version: '3.8'
services:
  app:
    image: 'jc21/nginx-proxy-manager:latest'
    restart: unless-stopped
    network_mode: "host"
    volumes:
      - ./data:/data
      - ./letsencrypt:/etc/letsencrypt

allowing nginx proxy manager running inside docker container to access the host network, so all apps that run directly on the host machine on different ports are accessible.

It has some additional benefits comparing to the default configuration

    ports:
      - '80:80'
      - '81:81'
      - '443:443'

Using ufw firewall on Ubuntu (not sure if it's also a flaw with other distros/firewalls), docker bypasses ufw configuration, opening listed ports, so port 81 is open too, even if in ufw you don't see it as open port.

It's a docker issue better described e.g. here:
What is the best practice of docker + ufw under Ubuntu - Stack Overflow

but by using

    network_mode: "host"

instead of opening certain ports, you also mitigate that problem with ufw.

<!-- gh-comment-id:1703804854 --> @adrianbienias commented on GitHub (Sep 2, 2023): @ycsin I ended up using the following docker compose configuration: ``` version: '3.8' services: app: image: 'jc21/nginx-proxy-manager:latest' restart: unless-stopped network_mode: "host" volumes: - ./data:/data - ./letsencrypt:/etc/letsencrypt ``` allowing nginx proxy manager running inside docker container to access the host network, so all apps that run directly on the host machine on different ports are accessible. It has some additional benefits comparing to the default configuration ``` ports: - '80:80' - '81:81' - '443:443' ``` Using `ufw` firewall on Ubuntu (not sure if it's also a flaw with other distros/firewalls), docker bypasses `ufw` configuration, opening listed ports, so port `81` is open too, even if in `ufw` you don't see it as open port. It's a docker issue better described e.g. here: [What is the best practice of docker + ufw under Ubuntu - Stack Overflow](https://stackoverflow.com/questions/30383845/what-is-the-best-practice-of-docker-ufw-under-ubuntu) but by using ``` network_mode: "host" ``` instead of opening certain ports, you also mitigate that problem with `ufw`.
Author
Owner

@ycsin commented on GitHub (Sep 2, 2023):

@ycsin I ended up using the following docker compose configuration:

version: '3.8'
services:
  app:
    image: 'jc21/nginx-proxy-manager:latest'
    restart: unless-stopped
    network_mode: "host"
    volumes:
      - ./data:/data
      - ./letsencrypt:/etc/letsencrypt

allowing nginx proxy manager running inside docker container to access host network, so all apps that run directly on the host machine on different ports are accessible.

Thanks for sharing the file!

<!-- gh-comment-id:1703805561 --> @ycsin commented on GitHub (Sep 2, 2023): > @ycsin I ended up using the following docker compose configuration: > > ``` > version: '3.8' > services: > app: > image: 'jc21/nginx-proxy-manager:latest' > restart: unless-stopped > network_mode: "host" > volumes: > - ./data:/data > - ./letsencrypt:/etc/letsencrypt > ``` > > allowing nginx proxy manager running inside docker container to access host network, so all apps that run directly on the host machine on different ports are accessible. Thanks for sharing the file!
Author
Owner

@github-actions[bot] commented on GitHub (Mar 19, 2024):

Issue is now considered stale. If you want to keep it open, please comment 👍

<!-- gh-comment-id:2005593515 --> @github-actions[bot] commented on GitHub (Mar 19, 2024): Issue is now considered stale. If you want to keep it open, please comment :+1:
Author
Owner

@github-actions[bot] commented on GitHub (Apr 30, 2025):

Issue was closed due to inactivity.

<!-- gh-comment-id:2840630421 --> @github-actions[bot] commented on GitHub (Apr 30, 2025): Issue was closed due to inactivity.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/nginx-proxy-manager-NginxProxyManager#738
No description provided.