1

I'm trying to get PiHole to run in a docker on my raspberry pi 4. For some reason I'm unable to solve an issue with lighttpd.

docker-compose.yaml:

  pihole:
    container_name: pihole
    image: pihole/pihole:latest
    network_mode: host
    environment:
      TZ: 'Europe/Amsterdam'
      WEBPASSWORD: 'helloW0rld' # temporary
      SERVERIP: 192.168.178.5
    volumes:
       - './etc-pihole/:/etc/pihole/'
       - './etc-dnsmasq.d/:/etc/dnsmasq.d/'
    dns:
      - 127.0.0.1
      - 1.1.1.1
    # 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

command:

docker-compose up -d pihole; docker-compose logs -tf --tail="50" pihole

Provides a returning error such as below:

pihole           | 2020-02-17T18:43:24.256524171Z Starting lighttpd
pihole           | 2020-02-17T18:43:24.364843550Z 2020-02-17 19:43:24: (network.c.464) can't bind to port: 127.0.0.1 80 Address already in use 
pihole           | 2020-02-17T18:43:24.382772710Z Stopping lighttpd
pihole           | 2020-02-17T18:43:24.389610163Z lighttpd: no process found

I've added SERVERIP already as environment variable as suggested in this issue tracker but it doesn't make any difference as without adding this variable.

5
  • "Can't bind to port, address already in use" means something is listening on the HTTP port already, which is a bit odd if that's a single purpose container.
    – goldilocks
    Feb 17 '20 at 19:42
  • My thoughts exactly
    – Casper
    Feb 17 '20 at 20:56
  • 1
    You need to be root (or have CAP_NET_BIND_SERVICE) to listen on ports <1024. Could it be related to that?
    – Mark Smith
    Feb 17 '20 at 21:06
  • I'm not a docker expert but I would expect the setup of the container to be executed as root.
    – Casper
    Feb 17 '20 at 21:11
  • Not necessarily, as that is not automatically desirable. You should try starting it docker run --cap-add=NET_ADMIN. But I don't think this will throw "address in use", it will throw "permission denied".
    – goldilocks
    Feb 18 '20 at 12:31
1

It seems like the issue was caused by capitalizing SERVERIP while I should've been using ServerIP. Changing the capitalization allowed me to access the web interface again.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.