mirror of
https://github.com/NginxProxyManager/nginx-proxy-manager.git
synced 2026-04-25 17:35:52 +03:00
[GH-ISSUE #2197] Host not working when using container's name with Podman #1574
Labels
No labels
awaiting feedback
bug
cannot reproduce
dns provider request
duplicate
enhancement
enhancement
enhancement
good first issue
help wanted
invalid
need more info
no certbot plugin available
product-support
pull-request
question
stale
troll
upstream issue
v2
v2
v2
v3
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/nginx-proxy-manager-NginxProxyManager#1574
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @matheusfenolio on GitHub (Aug 12, 2022).
Original GitHub issue: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/2197
Checklist
jc21/nginx-proxy-manager:latestdocker image?Describe the bug
I'm trying to add a host using the name of the container, and when I open the URL, a 502 bad gateway appears. I tried using Docker, and it worked, but with Podman, it only works with container's IP.
Nginx Proxy Manager Version
v2.9.18
To Reproduce
Steps to reproduce the behavior:
-Forward Hostname / IP: web
-Port: 80
Expected behavior
The Nginx welcome page should appear
Screenshots

Operating System
Tried on
Additional context
docker-compose.yml
version: '3'
services:
app:
image: 'jc21/nginx-proxy-manager:latest'
restart: unless-stopped
ports:
- '80:80'
- '81:81'
- '443:443'
volumes:
- ./data:/data
- ./letsencrypt:/etc/letsencrypt
@the1ts commented on GitHub (Aug 13, 2022):
Don't think this is an NPM issue, there is lots of talk of podman issues around DNS after the default network change that was done for Podman 4 which was released in May of this year. Seems although CNI was left as the network stack if network was already setup, the DNS plugin was no longer used by default so this is the symptom. Try adding the DNS plugin to Podman for the old CNI network you probably have or remove the exisiting old network and upgrade to the new default network type which does have DNS builtin.
@matheusfenolio commented on GitHub (Sep 9, 2022):
I'll give it a shot! I saw some issues about it, but I thought it was fixed since I'm able to connect two containers only using the container name.
@BrandonG777 commented on GitHub (Mar 29, 2023):
whats strange is DNS works properly from command line, and even for creating subfolder proxies but not hostname proxies. hostnames will intermittently resolve which has me scratching my head even more.
@BrandonG777 commented on GitHub (Mar 30, 2023):
Even using CNI network backend DNS is still intermittent. cannot replicate the issue at command line
@the1ts commented on GitHub (Mar 30, 2023):
Sorry, I don't use podman or npm anymore, but there is a good reason why command line and nginx work differently. DNS for the command line is done via podman or whatever is setting up the container. Nginx is setup to use /data/nginx/resolv.conf. This from memory gets set at first start and perhaps is incorrect or has multiple servers in it, hence intermittent.
@BrandonG777 commented on GitHub (Mar 30, 2023):
Well thanks for the reply anyway, you ultimately pointed me in the right direction. /data/nginx/resolv.conf no longer exist and didn't seem to have any affect on resolving this issue. However /etc/resolv.conf contained the podman host address and then my real host system dns entires. It appears that nginx was doing some sort of round robin selection of which DNS server it was going to use for lookup. Since this only affects host proxies and not subfolder location proxies I added a resolver entry to my host proxy custom config and that is working for me. I noticed the swag container uses 127.0.0.11 in it's resolver config which doesn't seem to work with this container. Maybe they are doing adding some sort of port forwarding or adding a package to make this work? Seems like that solution would work well for this container as well.
@fuzzyfox commented on GitHub (Jul 19, 2023):
I believe I have tracked this down to a combination how nginx appears to handle the DNS resolution when it has multiple resolvers specified, and podman DNS resolution.
The issues can be resolved by manually altering the
/etc/nginx/conf.d/include/resolvers.confto only include the podman resolver ip, and no other ips. In my case:This resolved my issues, obviously this wont stick through a container restart right now due to how this file is generated so as a more resilient interim solution I've added the updated resolvers line to the custom configs for proxies https://nginxproxymanager.com/advanced-config/#custom-nginx-configurations. Ideally I'd put it into the custom
http.conf, however as nginx does not allow redeclaring directives, this wont work right now.My proposal would be to allow a custom resolver config to be used on boot-up, and if it doesn't exist, then generate the file as it is right now.
@github-actions[bot] commented on GitHub (Feb 12, 2024):
Issue is now considered stale. If you want to keep it open, please comment 👍
@patrickklaeren commented on GitHub (Aug 23, 2024):
I believe I have this exact error running Portainer and using the hostname, the exact same as in the original description above.
@github-actions[bot] commented on GitHub (Mar 29, 2025):
Issue is now considered stale. If you want to keep it open, please comment 👍
@perryk commented on GitHub (Sep 3, 2025):
Just adding a comment to keep this issue open.
Same issue persists in latest NPM and Podman.
Mentioned also in #2608
@Raul824 commented on GitHub (Feb 9, 2026):
Am facing similar issue on PikaOS.
NPM Version 2.13.7
podman version 5.7.0
Output of curl command from host machine