[GH-ISSUE #191] Only works with container internal IP #168

Closed
opened 2026-02-26 06:31:05 +03:00 by kerem · 6 comments
Owner

Originally created by @Oujiii on GitHub (Aug 22, 2019).
Original GitHub issue: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/191

I'm not using the template simply because I don't know if this is the expected behaviour.

I just setup a new machine with npm and portainer. I ran npm first and it created a network called npm_default, so I run portainer passing the command --network=npm_default and it works as intended, all the three containers are in the same network.

While in the network, I can connect to 192.0.1.12:port (my internal ip) and it works. Also works it external-ip:port as it's listening on 0.0.0.0 by default, but for both portainer and npm admin page, if I try to proxy via http://192.0.1.12:9000 (portainer) and http://192.0.1.12:81 (npm admin) it doesn't work. It only proxies if I use the internal container IP + port. Is that intended? I didn't think so looking at the screenshots, that's why I'm asking.

I'm only worried as I'm deploying more containers, whenever I need to restart the node, the internal docker ips might not be the same anymore, thus messing all the proxies.

Thank you.

Originally created by @Oujiii on GitHub (Aug 22, 2019). Original GitHub issue: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/191 I'm not using the template simply because I don't know if this is the expected behaviour. I just setup a new machine with npm and portainer. I ran npm first and it created a network called npm_default, so I run portainer passing the command --network=npm_default and it works as intended, all the three containers are in the same network. While in the network, I can connect to 192.0.1.12:port (my internal ip) and it works. Also works it external-ip:port as it's listening on 0.0.0.0 by default, but for both portainer and npm admin page, if I try to proxy via http://192.0.1.12:9000 (portainer) and http://192.0.1.12:81 (npm admin) it doesn't work. It only proxies if I use the internal container IP + port. Is that intended? I didn't think so looking at the screenshots, that's why I'm asking. I'm only worried as I'm deploying more containers, whenever I need to restart the node, the internal docker ips might not be the same anymore, thus messing all the proxies. Thank you.
kerem 2026-02-26 06:31:05 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@beloniki commented on GitHub (Aug 22, 2019):

Hi.
You can use the portainer's container name instead ip as backend address.

<!-- gh-comment-id:523787003 --> @beloniki commented on GitHub (Aug 22, 2019): Hi. You can use the portainer's container name instead ip as backend address.
Author
Owner

@Oujiii commented on GitHub (Aug 22, 2019):

@beloniki Does that only work for any container in the same network?

I tested here and it worked. That's great. I'll keep this opened so I can get an answer on whether this is or isn't the intended behaviour.

<!-- gh-comment-id:523982565 --> @Oujiii commented on GitHub (Aug 22, 2019): @beloniki Does that only work for any container in the same network? I tested here and it worked. That's great. I'll keep this opened so I can get an answer on whether this is or isn't the intended behaviour.
Author
Owner

@beloniki commented on GitHub (Sep 24, 2019):

@Oujiii to get answer, you can read this documentation https://docs.docker.com/v17.09/engine/userguide/networking/configure-dns/

As I know, it works only in the same network.

<!-- gh-comment-id:534538917 --> @beloniki commented on GitHub (Sep 24, 2019): @Oujiii to get answer, you can read this documentation https://docs.docker.com/v17.09/engine/userguide/networking/configure-dns/ As I know, it works only in the same network.
Author
Owner

@henkisdabro commented on GitHub (Sep 10, 2020):

I'm experiencing issues with this too, I can only reach proxy hosts when configured with their internal ip as in 172.17.0.9 or similar. When entering either the service name or container name into the hosts box, they result in a 502 error. I have tried adding links inside my docker-compose on each service, but they don't seem to work either. My containers are all on the bridge network, and when restarting containers the IP's change. How can I make this work with docker DNS?

<!-- gh-comment-id:689924638 --> @henkisdabro commented on GitHub (Sep 10, 2020): I'm experiencing issues with this too, I can only reach proxy hosts when configured with their internal ip as in 172.17.0.9 or similar. When entering either the service name or container name into the hosts box, they result in a 502 error. I have tried adding links inside my docker-compose on each service, but they don't seem to work either. My containers are all on the bridge network, and when restarting containers the IP's change. How can I make this work with docker DNS?
Author
Owner

@chaptergy commented on GitHub (May 11, 2021):

See https://github.com/jc21/nginx-proxy-manager/pull/745#issuecomment-753558427

<!-- gh-comment-id:838894313 --> @chaptergy commented on GitHub (May 11, 2021): See https://github.com/jc21/nginx-proxy-manager/pull/745#issuecomment-753558427
Author
Owner

@TarikHaci commented on GitHub (Sep 23, 2023):

I have the same code as the fix here, but in my case I had also to EXPOSE my port in dockerfile, since I had a mapping in docker-compose 9000:port I though sufficient but it wasn't so I added the port which is EXPOSED to nginxproxymanager and not mapped and it worked.

<!-- gh-comment-id:1732290872 --> @TarikHaci commented on GitHub (Sep 23, 2023): I have the same code as the fix here, but in my case I had also to EXPOSE my port in dockerfile, since I had a mapping in docker-compose 9000:port I though sufficient but it wasn't so I added the port which is EXPOSED to nginxproxymanager and not mapped and it worked.
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#168
No description provided.