Pi Hole#

Update repositories:

sudo apt update && sudo apt upgrade -y

Step1: make a folder -

mkdir pihole

Step2: Navigate to the folder -

cd pihole

Step3: Create and edit a docker compose file -

nano docker-compose.yml

Step4: Copy the docker compose example from Pihole Github and update as needed. (This will download and run the pihole config).

My Example:

| services: pihole: container_name: pihole image: pihole/pihole:latest network_mode: host environment: TZ: ‘Asia/Kolkata’ # Adjust if needed WEBPASSWORD: ’entermyusername’ # Web UI login password FTLCONF_webserver_api_password: ‘changeme’ FTLCONF_DNS_LISTENING: ‘all’ # Ensures Pi-hole listens on all interfaces volumes:

  • /home/pi/pihole/etc-pihole:/etc/pihole
  • /home/pi/pihole/etc-dnsmasq.d:/etc/dnsmasq.d cap_add:
  • NET_ADMIN
  • SYS_TIME # Optional: lets container adjust system time if needed
  • SYS_NICE # Optional: gives process higher priority
    restart: unless-stopped

Step5: Run the docker compose file

docker compose up -d

Step6: Pihole is up and running, access it by visiting:

http://youripaddress/admin