Pihole is an adblock server based on DNS.

Steps

  • Install pihole with docker
  • Set that pihole installed server ip as DNS in your router / computer
  • You are done. http://<pihole-server-ip>/ to view the dashboard

Installation

docker-compose.yml

version: '2.0'
services:
  pihole:
    image: "diginc/pi-hole:${TAG}"
    ports:
      - 80:80
      - 53:53/tcp
      - 53:53/udp
    cap_add:
      - NET_ADMIN
    restart: always
    volumes:
      - ./config/:/etc/pihole/
      - ./log/pihole.log:/var/log/pihole.log
    environment:
      - ServerIP=${IP}

.env

# env used for pi-hole
TAG=alpine
IP_LOOKUP="$(ip route get 8.8.8.8 | awk 'NR == 1 {print $NF}')"  # May not work for VPN / tun0
IP="${IP:-$IP_LOOKUP}"  # use $IP, if set, otherwise IP_LOOKUP