Fix DNS Port 53 Already in Use on Raspberry Pi¶
If Pi-hole or AdGuard Home reports address already in use or Docker says port is already allocated, check which process owns port 53, on which IP address, and with which protocol. A local resolver on 127.0.0.53 and a DNS server for your network can often run on the same Pi by listening on different addresses.
Find what is using port 53¶
Run these on the Pi. Use sudo with ss so it can show processes owned by other accounts.
Look at the Local Address:Port column and the process name on the right. DNS uses both UDP and TCP. TCP sockets waiting for connections show LISTEN. A bound UDP socket waiting for datagrams usually shows UNCONN. ss manual
| Local address | What to check |
|---|---|
127.0.0.53:53 or 127.0.0.54:53 owned by systemd-resolved |
These are loopback addresses. Configure the new DNS server to use the Pi's LAN IP. |
0.0.0.0:53 |
This is an IPv4 wildcard bind. Identify the existing service and change its bind address or move one DNS server to another host. |
The Pi's LAN IP followed by :53 |
A service already owns the address clients would use. Decide which service should answer there before changing anything. |
[::]:53 or *:53 |
Inspect the owner and its IPv6 settings. An IPv6 wildcard socket can also accept IPv4, depending on how the application opens it. |
If Docker reports the conflict and ss gives no clear owner, check the PORTS column for a running container that has published host port 53. Run the Docker command with your usual permissions. Docker port publishing
Keep the host resolver and bind DNS to the LAN IP¶
If only the loopback stub is using port 53, keep it running and configure the new DNS service to listen on the Pi's reserved LAN address. Avoid overwriting /etc/resolv.conf as part of this repair. It can point to the host's existing resolver. systemd-resolved manual · Reserve an address for the Pi
For Pi-hole in a standard Docker Compose bridge network, use these two entries in the service's ports: list. Replace 192.168.1.42 with your Pi's LAN IPv4. The first 53 is the host port and the second is the container port. If the container uses host networking, configure its listener in the application. Compose port syntax
For AdGuard Home installed directly on the Pi, use the LAN address as the DNS listen address. AdGuard Home and Unbound setup
On a Pi 4B running Trixie, test sockets on 127.0.0.53 blocked a wildcard bind for both TCP and UDP. Binding 127.0.0.1 to the same port succeeded for both. We used a high test port to leave the Pi's DNS setup intact.
Verify DNS before changing router settings¶
Back on the Pi, rerun ss and confirm the new listener or Docker host mapping covers both protocols. From a LAN client with dig, send queries directly to the Pi over UDP and TCP. Substitute your Pi's address. BIND dig manual
Check for a reply from the Pi and a matching entry in the DNS service's query log. If only one transport works, check that protocol's listener, Docker mapping, and firewall rule. Once both work, configure the router to advertise the Pi's address to LAN clients over DHCP.