This is an update to this Post
When the Port 53 is already in Use, you can check this with this command (ubuntu):
Port 53 is being used at your host machine, that's why you can not bind 53 to host.
To find what is using port 53 you can do: sudo lsof -i -P -n | grep LISTEN
I'm a 99.9% sure that systemd-resolved is what is listening to port 53.
To solve that you need to edit the /etc/systemd/resolved.conf and uncomment DNSStubListener and change it to no, so it looks like this: DNSStubListener=no
After that reboot your system or restart the service with service systemd-resolved restart
Rando from the future: I am trying to find out what to do when this fails to work. For context, I am trying to run pihole locally on a docker container on my ubuntu desktop and have just my desktop use it for DNS.
I've tried addding DNSStubListener=no to /etc/systemd/resolved.conf and restarting the resolve service with sudo systemctl restart systemd-resolved.service . Every time I try and run docker compose up -d against the standard pihole setup (changed password and timezone accordingly) I get the following classic error
failed to bind port 0.0.0.0:53/tcp: Error starting userland proxy: listen tcp4 0.0.0.0:53: bind: address already in use
Any idea what's up? Running sudo lsof -i -P -n | grep LISTEN shows dnsmasq running: