2.8 KiB
2.8 KiB
#documentation #homelab Official docs can be found on the github page and the home page
Preperation
- The system was entirely updated with
sudo apt update
andsudo apt upgrade
. docker
anddocker-compose
were installed viaapt
- It was noted that
docker.service
was not running, with an error similar to
Error starting daemon: Error initializing network controller: error obtaining controller instance: failed to create NAT chain DOCKER: iptables failed: iptables -t nat -N DOCKER: iptables v1.8.2 (nf_tables): CHAIN_ADD failed
- This was resolved by running the commands below as detailed here
sudo update-alternatives --set iptables /usr/sbin/iptables-legacy
sudo update-alternatives --set ip6tables /usr/sbin/ip6tables-legacy
Deployment
- A
docker-compose.yml
file was created with the contents:
version: "3"
# More info at https://github.com/pi-hole/docker-pi-hole/ and https://docs.pi-hole.net/
services:
pihole:
# start on boot and when crashed
restart: unless-stopped
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
- "80:80/tcp"
environment:
TZ: 'America/Chicago'
# set the web dashboard to have no passwd
WEBPASSWORD: ''
# 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
The time zone was updated to the correct timezone, a configuration option added to make the container start automatically, and the docker container started with (Note: If you are not using a docker
user, you will need to add your user to the docker group. This can be done with sudo usermod -aG docker [user]
):
docker-compose -f docker-compose.yml up -d
You can check the status of all docker containers with docker ps
, and get detailed logs for the pihole container with docker logs pihole
Test and see if the pihole is running by changing a system's DNS server to the pihole's IP, then going to http://[ip]/admin/
or http://pi.hole
Troubleshooting
- Restart the server:
sudo reboot -h now
- Check if the container is running:
docker ps
- Check the logs:
docker logs pihole
- See if the container is listening(grep can be omitted to check all services):
sudo ss -tulpn | grep 53