I wanted to secure my home network a little more and block those irritating adds you see more and more on the net.
After some searching I came across Pi-Hole. And available as a Docker so party on 🙂
Well we are going to create a macvlan in docker. That gives us a bit of wiggle room with ports that already are configured. So with macvlan in Docker we can give containers their own ip.
Connect to your Pi terminal or ssh session. Adjust he subnet and gateway so it corresponds with your network.
sudo docker network create -d macvlan –subnet=192.168.178.0/24 –gateway=192.168.178.1 -o parent=eth0 macvlan
Now we are going to install the Pi-Hole.
In your terminal:
sudo mkdir /docker/pi-hole && cd /docker/pi-hole
sudo nano docker-compose.yml
Copy and adjust the text below:
version: '2' services: pihole: container_name: pihole image: pihole/pihole:latest hostname: pihole0 cap_add: - NET_ADMIN networks: macvlan: # same as network specified below ipv4_address: 192.168.178.3 # the IP of the pihole container dns: - 127.0.0.1 # use local DNS, since the pihole - 1.1.1.1 # optional fallback DNS ports: # expose all pihole ports. - 443/tcp - 53/tcp - 53/udp - 67/udp - 80/tcp volumes: # mount our data volumes. - '/docker/pi-hole/etc-pihole/:/etc/pihole/' - '/docker/pi-hole/etc-dnsmasq.d/:/etc/dnsmasq.d/' - '/docker/pi-hole/backups/:/backups/' environment: ServerIP: 192.168.178.3 # must match ipv4_address above WEBPASSWORD: "somepassword" TZ: 'Europe/Amsterdam' # pick your timezone restart: unless-stopped networks: macvlan: external: true
Close the file and now its time to bring up the docker.
sudo docker-compose up -d
After a minute Pihole should be up and running and you could access it: http://your.ip