Skip to content

Instantly share code, notes, and snippets.

@deskoh
Created June 12, 2022 10:11
Show Gist options
  • Save deskoh/14791d3387950d22b250e13973581d4a to your computer and use it in GitHub Desktop.
Save deskoh/14791d3387950d22b250e13973581d4a to your computer and use it in GitHub Desktop.
Pihole setup
# Install docker
apt install docker.io
# Use following if `apt install docker.io` not available
apt update
apt install apt-transport-https ca-certificates curl gnupg lsb-release -y
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
apt update
apt -y install docker-ce docker-ce-cli containerd.io
# Configure systemd-resolved not to use port 54
sed -r -i.orig 's/#?DNSStubListener=yes/DNSStubListener=no/g' /etc/systemd/resolved.conf
ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.conf
systemctl restart systemd-resolved
# Create container
docker create --name pihole --restart=unless-stopped \
-p 53:53/udp -p 53:53 -p 80:80 \
-e TZ=Asia/Singapore \
-e PIHOLE_DNS_=1.1.1.1;8.8.8.8 \
-v etc-pihole:/etc/pihole -v etc-dnsmasq.d:/etc/dnsmasq.d \
pihole/pihole:2022.04.3
# Change default password
docker exec -it pihole pihole -a -p
# Under Settings -> DNS, update `Respond only on interface eth0`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment