Pi-hole ip does not work as dns server

Expected Behaviour:

Running an ubuntu 23.04 server with latest pi-hole in a docker container, everything up to the date.
From what I've read, I believe that the ip of my raspberry pi should be used as the dns server for my devices.

Actual Behaviour:

Using the ip of my raspberry pi as the preferred dns server causes all pages to say "dns could not be resolved".
This issue is fixed using my ISPs default dns servers or any others.

Debug Token:

https://tricorder.pi-hole.net/xUgSGpYo/]

Please, post the compose file or docker run command used to start your container.

This is the docker-compose file I used, the ports are changed because I was getting an error saying that the original ports were already in use when trying to run the container.

services:
  pihole:
    container_name: pihole
    image: pihole/pihole:latest
    ports:
      - "5053:53/tcp"
      - "5053:53/udp"
      - "6067:67/udp"
      - "8080:80/tcp"
    environment:
      TZ: 'Australia/Melbourne'
      WEBPASSWORD: 'password'
    volumes:
      - './etc-pihole:/etc/pihole'
      - './etc-dnsmasq.d:/etc/dnsmasq.d'
    cap_add:
      - NET_ADMIN
    restart: unless-stopped

Oh I also forgot to mention that the admin panel works perfectly, and I can access it using the ip of the raspberry pi and port 8080

Port 53 is the standard port for DNS, i.e. all clients will use that port for DNS requests.

Even in theory, remapping port 53 could only be successful if you would be able to configure each and any client in your network to refrain from using port 53 for DNS, resorting to your chosen 5053 instead.

In practice, you'd have to stick to port 53.

When I use

ports:
      - "53:53/tcp"
      - "53:53/udp"
      - "6067:67/udp"
      - "8080:80/tcp"

I get the error below

sudo docker-compose up -d
[sudo] password for server:
Recreating pihole ...
Recreating pihole ... error

ERROR: for pihole  Cannot start service pihole: driver failed programming external connectivity on endpoint pihole): Error starting userland proxy: listen tcp4 0.0.0.0:53: bind: address already in use

ERROR: for pihole  Cannot start service pihole: driver failed programming external connectivity on endpoint pihole: Error starting userland proxy: listen tcp4 0.0.0.0:53: bind: address already in use
ERROR: Encountered errors while bringing up the project.

How would I go about fixing this error?
This is the only container running in docker and I used a clean installation of the ubuntu server and only installed docker and pihole so I'm not sure what else is using those ports

This means there is a service using port 53.

You need to disabled (or uninstall) it before start the container.

On the command line what is the output of sudo ss -tulpn | grep ":53\s" ?

(Edit: I forgot to add sudo).

Port 67 is also a standard port (DHCP) that should not be changed.
(Should have mentioned that earlier...)

Check the output of

sudo ss -tulpn '( sport = :53 )'

for the process that hogs the same ports.

Ok so I fixed port 67 as well now, these are the outputs

sudo ss -tulpn | grep ":53\s"
udp   UNCONN 0      0                             127.0.0.54:53         0.0.0.0:                                                                  *    users:(("systemd-resolve",pid=494,fd=15))
udp   UNCONN 0      0                          127.0.0.53%lo:53         0.0.0.0:                                                                  *    users:(("systemd-resolve",pid=494,fd=13))
tcp   LISTEN 0      4096                          127.0.0.54:53         0.0.0.0:                                                                  *    users:(("systemd-resolve",pid=494,fd=16))
tcp   LISTEN 0      4096                       127.0.0.53%lo:53         0.0.0.0:                                                                  *    users:(("systemd-resolve",pid=494,fd=14))

and

sudo ss -tulpn '( sport = :53 )'
Netid     State      Recv-Q     Send-Q          Local Address:Port           Peer Address:Port     Process
udp       UNCONN     0          0                  127.0.0.54:53                  0.0.0.0:*         users:(("systemd-resolve",pid=494,fd=15))
udp       UNCONN     0          0               127.0.0.53%lo:53                  0.0.0.0:*         users:(("systemd-resolve",pid=494,fd=13))
tcp       LISTEN     0          4096               127.0.0.54:53                  0.0.0.0:*         users:(("systemd-resolve",pid=494,fd=16))
tcp       LISTEN     0          4096            127.0.0.53%lo:53                  0.0.0.0:*         users:(("systemd-resolve",pid=494,fd=14))

Thatsystemd-resolve process is Ubuntu's stub resolver that is already listening on port 53.
As rdwebdesign has recommended, you'd have to disable it.

Perfect, thank you both. Disabling systemd-resolve lets me run the pihole container with no troubles and it functions as expected.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.