[GH-ISSUE #203] Can't communicate by name on docker network #180

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

Originally created by @jfrancais on GitHub (Sep 23, 2019).
Original GitHub issue: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/203

I currently have this setup in a user defined docker network, "dockerwp". In that network I have several other docker containers running as backend. I have setup npm and have created several proxy hosts to point to the backened containers, again in that dockerwp network. If I set npm to talk to them by name (ie http://website1) it can't communicate. If I use the same settings and put use the internal ip address of that container (ie 172.21.0.6) everything communicates as expected. Since I'm spinning up and removing containers quite regularly I'm, wasting a lot of time looking up the IP, it would be nice to be able to communicate by name, which should be possible on a user defined network.

Originally created by @jfrancais on GitHub (Sep 23, 2019). Original GitHub issue: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/203 I currently have this setup in a user defined docker network, "dockerwp". In that network I have several other docker containers running as backend. I have setup npm and have created several proxy hosts to point to the backened containers, again in that dockerwp network. If I set npm to talk to them by name (ie http://website1) it can't communicate. If I use the same settings and put use the internal ip address of that container (ie 172.21.0.6) everything communicates as expected. Since I'm spinning up and removing containers quite regularly I'm, wasting a lot of time looking up the IP, it would be nice to be able to communicate by name, which should be possible on a user defined network.
kerem 2026-02-26 06:31:11 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

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

Can you communicate to other containers from inside the npm container?

<!-- gh-comment-id:534547667 --> @beloniki commented on GitHub (Sep 24, 2019): Can you communicate to other containers from inside the npm container?
Author
Owner

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

Yes. For example, it I do:

docker exec -it NPMCONTAINER /bin/bash
I can then ping both the IP 172.21.0.6 and website1
I can curl both the IP http://172.21.0.6 and http://website1

Using the web interface, if I set up a proxy host to point to http://172.21.0.6 on 80 it works, but if I set up http://website1 on 80 it does not. (I get a 502 Bad Gateway message)

<!-- gh-comment-id:534574441 --> @jfrancais commented on GitHub (Sep 24, 2019): Yes. For example, it I do: docker exec -it NPMCONTAINER /bin/bash I can then ping both the IP 172.21.0.6 and website1 I can curl both the IP http://172.21.0.6 and http://website1 Using the web interface, if I set up a proxy host to point to http://172.21.0.6 on 80 it works, but if I set up http://website1 on 80 it does not. (I get a 502 Bad Gateway message)
Author
Owner

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

Using the web interface, if I set up a proxy host to point to http://172.21.0.6 on 80 it works, but if I set up http://website1 on 80 it does not. (I get a 502 Bad Gateway message)

Do you see 502 error in npm logs? If you do, attach this log here, please.
Maybe this error is from the backend?

<!-- gh-comment-id:535077867 --> @beloniki commented on GitHub (Sep 25, 2019): > Using the web interface, if I set up a proxy host to point to http://172.21.0.6 on 80 it works, but if I set up http://website1 on 80 it does not. (I get a 502 Bad Gateway message) Do you see 502 error in npm logs? If you do, attach this log here, please. Maybe this error is from the backend?
Author
Owner

@jfrancais commented on GitHub (Sep 25, 2019):

[20/Sep/2019:21:44:08 +0000] - - 502 - GET https MY.PROXY.HOST "/" [Client ##.##.##.## [Length 150] [Gzip -] [Sent-to website1] "curl/7.61.1" "-"

This is in my error log, I have changed the domain I'm using to MY.PROXY.HOST and changed my ip address.

<!-- gh-comment-id:535157518 --> @jfrancais commented on GitHub (Sep 25, 2019): [20/Sep/2019:21:44:08 +0000] - - 502 - GET https MY.PROXY.HOST "/" [Client ##.##.##.## [Length 150] [Gzip -] [Sent-to website1] "curl/7.61.1" "-" This is in my error log, I have changed the domain I'm using to MY.PROXY.HOST and changed my ip address.
Author
Owner

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

Ok, try to find what happens at this time [20/Sep/2019:21:44:08 +0000] in error.log, or find events where the website1 participates. I think this may help to find out the cause.

<!-- gh-comment-id:535382001 --> @beloniki commented on GitHub (Sep 26, 2019): Ok, try to find what happens at this time [20/Sep/2019:21:44:08 +0000] in error.log, or find events where the website1 participates. I think this may help to find out the cause.
Author
Owner

@jfrancais commented on GitHub (Sep 26, 2019):

After reviewing all the logs, I see the issue. My container name is "Wordpress1". It has an uppercase W. In NPM, it is entered as "Wordpress1", also with uppercase W. When I reviewed the logs I see it was using "wordpress1" lowercase W. So NPM is not using the case for the transfer host as entered, it lowercases it. And the container name is case sensitive. I verified this by destroying the container and recreating it with lowercase w and it started working.

So my interm fix is to name my containers all lowercase, but I think that the function that lower cases the forward host should be addressed.

<!-- gh-comment-id:535537607 --> @jfrancais commented on GitHub (Sep 26, 2019): After reviewing all the logs, I see the issue. My container name is "Wordpress1". It has an uppercase W. In NPM, it is entered as "Wordpress1", also with uppercase W. When I reviewed the logs I see it was using "wordpress1" lowercase W. So NPM is not using the case for the transfer host as entered, it lowercases it. And the container name is case sensitive. I verified this by destroying the container and recreating it with lowercase w and it started working. So my interm fix is to name my containers all lowercase, but I think that the function that lower cases the forward host should be addressed.
Author
Owner

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

Good research.

<!-- gh-comment-id:536438388 --> @beloniki commented on GitHub (Sep 30, 2019): Good research.
Author
Owner

@Mechazawa commented on GitHub (Nov 28, 2020):

Adding resolver 127.0.0.11; to the proxy config fixes this issue

<!-- gh-comment-id:735301432 --> @Mechazawa commented on GitHub (Nov 28, 2020): Adding `resolver 127.0.0.11;` to the proxy config fixes this issue
Author
Owner

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

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

<!-- gh-comment-id:838893515 --> @chaptergy commented on GitHub (May 11, 2021): See https://github.com/jc21/nginx-proxy-manager/pull/745#issuecomment-753558427
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#180
No description provided.