[GH-ISSUE #904] NPM fails to start using Pihole dns in docker #763

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

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

Describe the bug
When starting docker app (2.7.2) using PiHole dns running in a separate container on the same host, the following is logged during startup:

app_1  | [2/18/2021] [2:03:37 PM] [Migrate  ] › ℹ  info      Current database version: 20201014143841
app_1  | [2/18/2021] [2:04:20 PM] [Global   ] › ✖  error     Command failed: pip3 install certbot-dns-cloudflare==1.8.0 cloudflare
app_1  | WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7f9c8898ae20>: Failed to establish a new connection: [Errno -3] Try again')': /simple/certbot-dns-cloudflare/
app_1  | WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7f9c8898ad60>: Failed to establish a new connection: [Errno -3] Try again')': /simple/certbot-dns-cloudflare/
app_1  | WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7f9c8896a490>: Failed to establish a new connection: [Errno -3] Try again')': /simple/certbot-dns-cloudflare/
app_1  | WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7f9c8896a340>: Failed to establish a new connection: [Errno -3] Try again')': /simple/certbot-dns-cloudflare/
app_1  | WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7f9c8896a4c0>: Failed to establish a new connection: [Errno -3] Try again')': /simple/certbot-dns-cloudflare/
app_1  | ERROR: Could not find a version that satisfies the requirement certbot-dns-cloudflare==1.8.0 (from versions: none)
app_1  | ERROR: No matching distribution found for certbot-dns-cloudflare==1.8.0

If I add the 'dns' option to my docker-compose file and point it to 8.8.8.8 NPM loads without issues.

I have tried setting the same option to the various docker and physical ips, but they yield the same error.

I have several other containers, servers and clients that successfully use the Pihole container as their dns.

Any advise on this strange issue?

Originally created by @pittbull on GitHub (Feb 18, 2021). Original GitHub issue: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/904 **Describe the bug** When starting docker app (2.7.2) using PiHole dns running in a separate container on the same host, the following is logged during startup: ``` app_1 | [2/18/2021] [2:03:37 PM] [Migrate ] › ℹ info Current database version: 20201014143841 app_1 | [2/18/2021] [2:04:20 PM] [Global ] › ✖ error Command failed: pip3 install certbot-dns-cloudflare==1.8.0 cloudflare app_1 | WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7f9c8898ae20>: Failed to establish a new connection: [Errno -3] Try again')': /simple/certbot-dns-cloudflare/ app_1 | WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7f9c8898ad60>: Failed to establish a new connection: [Errno -3] Try again')': /simple/certbot-dns-cloudflare/ app_1 | WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7f9c8896a490>: Failed to establish a new connection: [Errno -3] Try again')': /simple/certbot-dns-cloudflare/ app_1 | WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7f9c8896a340>: Failed to establish a new connection: [Errno -3] Try again')': /simple/certbot-dns-cloudflare/ app_1 | WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7f9c8896a4c0>: Failed to establish a new connection: [Errno -3] Try again')': /simple/certbot-dns-cloudflare/ app_1 | ERROR: Could not find a version that satisfies the requirement certbot-dns-cloudflare==1.8.0 (from versions: none) app_1 | ERROR: No matching distribution found for certbot-dns-cloudflare==1.8.0 ``` If I add the 'dns' option to my docker-compose file and point it to 8.8.8.8 NPM loads without issues. I have tried setting the same option to the various docker and physical ips, but they yield the same error. I have several other containers, servers and clients that successfully use the Pihole container as their dns. Any advise on this strange issue?
kerem 2026-02-26 06:34:18 +03:00
  • closed this issue
  • added the
    stale
    bug
    labels
Author
Owner

@Zerwin commented on GitHub (Mar 17, 2021):

Both PiHole and Nginx use the port 80 and 443, how did you work around that ? I don't think you can have the same ports in use for 2 containers on 1 host.

<!-- gh-comment-id:801068000 --> @Zerwin commented on GitHub (Mar 17, 2021): Both PiHole and Nginx use the port 80 and 443, how did you work around that ? I don't think you can have the same ports in use for 2 containers on 1 host.
Author
Owner

@SteveGBuck commented on GitHub (Mar 17, 2021):

@Zerwin, I use "expose" rather than "ports" in my pihole container config. Then let NPM proxy to pihole using the docker network. The only thing Im unsure of is that this is not blocking SSL based adverts which I'm looking at right now.

Here's my docker-compose.yml for pihole (but NPM uses the same external "proxy" network).

version: "3.2"

# More info at https://github.com/pi-hole/docker-pi-hole/ and https://docs.pi-hole.net/
services:
  pihole:
    container_name: pihole
    image: pihole/pihole:latest
    ports:
      - 53:53/tcp
      - 53:53/udp
    expose:
      - 67/udp
      - 80/tcp
      - 443/tcp
    environment:
      TZ: 'Europe/London'
      WEBPASSWORD: '***********'
    # Volumes store your data between container upgrades
    volumes:
      - etc-pihole:/etc/pihole/
      - etc-dnsmasq.d:/etc/dnsmasq.d/
    # Recommended but not required (DHCP needs NET_ADMIN)
    #   https://github.com/pi-hole/docker-pi-hole#note-on-capabilities
    #cap_add:
    #  - NET_ADMIN
    restart: unless-stopped

volumes:
  etc-pihole:
  etc-dnsmasq.d:
  
networks:
  default:
    external:
      name: proxy
<!-- gh-comment-id:801090168 --> @SteveGBuck commented on GitHub (Mar 17, 2021): @Zerwin, I use "expose" rather than "ports" in my pihole container config. Then let NPM proxy to pihole using the docker network. The only thing Im unsure of is that this is not blocking SSL based adverts which I'm looking at right now. Here's my docker-compose.yml for pihole (but NPM uses the same external "proxy" network). ``` version: "3.2" # More info at https://github.com/pi-hole/docker-pi-hole/ and https://docs.pi-hole.net/ services: pihole: container_name: pihole image: pihole/pihole:latest ports: - 53:53/tcp - 53:53/udp expose: - 67/udp - 80/tcp - 443/tcp environment: TZ: 'Europe/London' WEBPASSWORD: '***********' # Volumes store your data between container upgrades volumes: - etc-pihole:/etc/pihole/ - etc-dnsmasq.d:/etc/dnsmasq.d/ # Recommended but not required (DHCP needs NET_ADMIN) # https://github.com/pi-hole/docker-pi-hole#note-on-capabilities #cap_add: # - NET_ADMIN restart: unless-stopped volumes: etc-pihole: etc-dnsmasq.d: networks: default: external: name: proxy ```
Author
Owner

@Zerwin commented on GitHub (Mar 17, 2021):

From the PiHole docker hub site:

Port 443 is to provide a sinkhole for ads that use SSL. If only port 80 is used, then blocked HTTPS queries will fail to connect to port 443 and may cause long loading times. Rejecting 443 on your firewall can also serve this same purpose. Ubuntu firewall example: sudo ufw reject https


As you are only exposing port 443 it's never available to anything outside NPM and PiHole. You need to properly publish port 443 for this to work.

Overall I would suggest moving away from exposing ports and putting PiHole on a different VM/Server. You can still use docker there if you like. Exposing ports like you are now is probably also what is causing the original problem.

<!-- gh-comment-id:801101959 --> @Zerwin commented on GitHub (Mar 17, 2021): From the PiHole docker hub site: Port 443 is to provide a sinkhole for ads that use SSL. If only port 80 is used, then blocked HTTPS queries will fail to connect to port 443 and may cause long loading times. Rejecting 443 on your firewall can also serve this same purpose. Ubuntu firewall example: sudo ufw reject https ---------------------- As you are only exposing port 443 it's never available to anything outside NPM and PiHole. You need to properly publish port 443 for this to work. Overall I would suggest moving away from exposing ports and putting PiHole on a different VM/Server. You can still use docker there if you like. Exposing ports like you are now is probably also what is causing the original problem.
Author
Owner

@SteveGBuck commented on GitHub (Mar 17, 2021):

@Zerwin I'm not the OP, but I have no issue starting up NPM and Pihole this way (i.e no port conflict) and at the moment Pihole looks like its working. But as you rightly point out Im not sure I've resolved the whole SSL sinkhole problem (I need to find a site that uses SSL adverts to test). I did also follow the instruction in the guides to set the default site in NPM to redirect to my pihole address - maybe this is addressing the SSL sinkhole problem?

<!-- gh-comment-id:801123445 --> @SteveGBuck commented on GitHub (Mar 17, 2021): @Zerwin I'm not the OP, but I have no issue starting up NPM and Pihole this way (i.e no port conflict) and at the moment Pihole looks like its working. But as you rightly point out Im not sure I've resolved the whole SSL sinkhole problem (I need to find a site that uses SSL adverts to test). I did also follow the instruction in the guides to set the default site in NPM to redirect to my pihole address - maybe this is addressing the SSL sinkhole problem?
Author
Owner

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

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

<!-- gh-comment-id:2002735528 --> @github-actions[bot] commented on GitHub (Mar 18, 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 29, 2025):

Issue was closed due to inactivity.

<!-- gh-comment-id:2837247173 --> @github-actions[bot] commented on GitHub (Apr 29, 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#763
No description provided.