curl -sSL https://get.docker.com | sh
). You can refer
this article
sudo mkdir -p /opt/stacks/pihole
and cd to newly created directory.
cd /opt/stacks/pihole
sudo nano compose.yaml
and add following contents to it and save the file:
version: "3"
services:
pihole:
container_name: pihole
image: pihole/pihole:latest
ports:
- "53:53/tcp"
- "53:53/udp"
- "67:67/udp"
- "80:80/tcp" # Use 8080:80/tcp if you have another service running on port 80
- "443:443/tcp"
dns:
- 127.0.0.1
- 1.1.1.1
environment:
TZ: 'Europe/London' # https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
WEBPASSWORD: "YOUR_PASSWORD_HERE" # Replace this with your password. Pi-Hole will randomly generate the password if you don’t set a value.
volumes:
- './etc-pihole:/etc/pihole'
- './etc-dnsmasq.d:/etc/dnsmasq.d'
cap_add:
- NET_ADMIN
restart: unless-stopped
sudo docker compose up -d
docker logs -f pihole
Or you can access the shell with:
sudo docker exec -it pihole bash
http://<your_raspberry_pi_ip_address>
.
You can now enjoy ad-free browsing on your network! Pi-hole will block ads and trackers at the network level.
To access the Pi-hole admin interface, open a web browser and navigate to
http://<your_raspberry_pi_ip_address>/admin
.