pi-hole / docker-pi-hole

Pi-hole in a docker container
https://pi-hole.net
Other
8.54k stars 1.13k forks source link

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

Closed octomobiki closed 1 hour ago

octomobiki commented 21 hours ago

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

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
  2. 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 'PIHOLEDNS'='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

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 commented 21 hours ago

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 commented 21 hours ago

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 commented 21 hours ago

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 commented 20 hours ago

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 commented 19 hours ago

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:

octomobiki commented 1 hour ago

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. :)