Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker pihole fails to come stating that port is already in use in Unraid #1657

Closed
1 task
octomobiki opened this issue Nov 7, 2024 · 6 comments
Closed
1 task

Comments

@octomobiki
Copy link

This is a: Bug (maybe?)

Details

When I go to startup pihole in docker on Unraid, I get the following problem. It states that it can't bind to port 0.0.0.0:443, but shouldn't it be binding to 192.168.1.104 and not 0.0.0.0 ? Container fails to come up in bridged mode under Unraid.

docker: Error response from daemon: driver failed programming external connectivity on endpoint pihole (2517993e19f453e9bee8613d2ca9293a1841aab7b5cd755c8cf916d4f4877578): Error starting userland proxy: listen tcp4 0.0.0.0:443: bind: address already in use.

Related Issues

  • [ X] I have searched this repository/Pi-hole forums for existing issues and pull requests that look similar

How to reproduce the issue

  1. Environment data
  • Operating System: Unraid
  • Hardware: Custom Built machine, ProArt X670E-CREATOR WIFI , AMD Ryzen 7 7700X 8-Core ...
  • Kernel Architecture: Unraid version 6.12.11
  • Docker Install Info and version:
    • Software source: ?
    • Supplimentary Software:
  • Hardware architecture: x86
  1. docker-compose.yml contents, docker run shell command, or paste a screenshot of any UI based configuration of containers here

docker run
-d
--name='pihole'
--net='bridge'
-e TZ="America/New_York"
-e HOST_OS="Unraid"
-e HOST_HOSTNAME="Melchior"
-e HOST_CONTAINERNAME="pihole"
-e 'PIHOLE_DNS_'='1.1.1.1,8.8.8.8;8.8.4.4'
-e 'TZ'='America/New York'
-e 'WEBPASSWORD'='#########'
-e 'INTERFACE'='br0'
-e 'ServerIP'='192.168.1.104'
-e 'ServerIPv6'=''
-e 'IPv6'='False'
-e 'DNSMASQ_LISTENING'='all'
-e 'WEBUIBOXEDLAYOUT'='boxed'
-l net.unraid.docker.managed=dockerman
-l net.unraid.docker.webui='http://[IP]:[PORT:80]/admin'
-l net.unraid.docker.icon='https://i.imgur.com/OWkNcEn.png'
-p '53:53/tcp'
-p '53:53/udp'
-p '67:67/udp'
-p '80:80/tcp'
-p '443:443/tcp'
-v '/mnt/user/appdata/pihole/pihole/':'/etc/pihole/':'rw'
-v '/mnt/user/appdata/pihole/dnsmasq.d/':'/etc/dnsmasq.d/':'rw'
--cap-add=NET_ADMIN
--restart=unless-stopped 'pihole/pihole:latest'

  1. any additional info to help reproduce

These common fixes didn't work for my issue

  • [X ] I have tried removing/destroying my container, and re-creating a new container
  • [ X] I have tried fresh volume data by backing up and moving/removing the old volume data
  • [ X] I have tried running the stock docker run example(s) in the readme (removing any customizations I added)
  • [ X] I have tried a newer or older version of Docker Pi-hole (depending what version the issue started in for me)
  • I have tried running without my volume data mounts to eliminate volumes as the cause

If the above debugging / fixes revealed any new information note it here.
Add any other debugging steps you've taken or theories on root cause that may help.

@rdwebdesign
Copy link
Member

You are using the pihole/pihole:latest tag.
This image doesn't use port 443. There is nothing inside the container listening on this port.

Only ports 80, 53 and 67 are exposed.

Image

You can simply remove this port from your command and try again.

@octomobiki
Copy link
Author

octomobiki commented Nov 7, 2024

Tried it again (with that setting removed, that I did not go in there and add myself :) ) and got:

docker: Error response from daemon: driver failed programming external connectivity on endpoint pihole (9cefd1910ac733c68c4aea95d3d3a72de1a73f70bcb6de83d926cfa8a24ead66): Error starting userland proxy: listen tcp4 0.0.0.0:80: bind: address already in use.

should that address be 0.0.0.0 or should it be the assigned ServerIP?

@rdwebdesign
Copy link
Member

No.
This message means your host OS is already using port 80 (probably apache2 or nginx is running on the host).

When you use docker and publish (-p) a port, this port needs to be free on the host.
You can find some details in docker docs.

Please read our README file.
There you can find how to change web port (80) to something else to avoid conflicts, using the WEB_PORT environment variable.

Note:
If you receive a similar error about port 53 you will need to disable the service using this port (or move the service to another port).
Pi-hole needs port 53 to work.

@octomobiki
Copy link
Author

will check further into tomorrow. seems funny because this was working for months then stopped. and i can't figure out what changed to make this happen. thank you for your guidance so far.

@rdwebdesign
Copy link
Member

seems funny because this was working for months then stopped. and i can't figure out what changed to make this happen.

This is not a Pi-hole issue, but an OS issue on the host.

If Pi-hole was working before, but now it's failing, I guess your OS was updated and something was installed, reconfigured or enabled without you noticing.

Hints:

  • port 80 is the web interface port.
    If this port was free and now it's is use, it means there is a new web server on the host OS using this port.
    Solution 1: change Pi-hole port using WEB_PORT.
    Solution 2: disable the web server running on the host.
  • port 443 was never used by latest Pi-hole images (or previous images), but this is also a port used by web servers. This also shows there is a new web server on the host OS using this port, as above.
  • on the host, execute sudo ss -tupln sport = 80 or sport = 443 to see what service is using these ports.

@octomobiki
Copy link
Author

So I have the answer. Somewhere in here I lost this very very important setting:

Image

this was set to 'bridge' before. so it was trying to use the ports on the original interface for unraid. but now that I have it bound to this custom interface with it's own IP it can bind to the ports that it needs. now I have pihole working again. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants