Pihole-Docker
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
1.8 KiB

services:
pihole:
container_name: pihole
image: pihole/pihole:latest
# For DHCP it is recommended to remove these ports and instead add: network_mode: "host"
ports:
- "53:53/tcp"
- "53:53/udp"
- "67:67/udp" # Only required if you are using Pi-hole as your DHCP server
- "9090:80/tcp"
environment:
TZ: 'Asia/Dhaka'
WEBPASSWORD: '469205'
# Volumes store your data between container upgrades
volumes:
- './etc-pihole:/etc/pihole'
- './etc-dnsmasq.d:/etc/dnsmasq.d'
# https://github.com/pi-hole/docker-pi-hole#note-on-capabilities
cap_add:
- NET_ADMIN # Required if you are using Pi-hole as your DHCP server, else not needed
restart: unless-stopped
Note: To solve DNS port 53 error
-------------------------------------------------------------------
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 disable it. You can do that with these 2 commands:
systemctl disable systemd-resolved.service
systemctl stop systemd-resolved
Now you have port 53 open, but no dns configured for your host. To fix that, you need to edit '/etc/resolv.conf' and add the dns address. This is an example with a common dns address:
nameserver 8.8.8.8
If you have another nameserver in that file, I would comment it to prevent issues.
Once pihole docker container gets running, you can change the dns server of your host to localhost, as you are binding port 53 to the host machine. Change again '/etc/resolv.conf' like this
nameserver 127.0.0.1
Hope this helped! ( I recommend you to learn docker-compose, it is easier to use than 'docker run' IMO)