Mastodon Mastodon - Pi-Hole in Docker
 logo
  • Home 
  • Tags 
  • Blog posts 
  1. Home
  2. Blog posts
  3. Pi-Hole in Docker

Pi-Hole in Docker

Posted on May 30, 2021  (Last modified on July 11, 2024) • 1 min read • 172 words
Home Network   Pihole   Tools: Pihole  
Home Network   Pihole   Tools: Pihole  
Share via
Link copied to clipboard

On this page
  • disable systemd-resolved stub
  • run pi-hole in docker-compose
  • Update pi-hole entries

disable systemd-resolved stub  

First, disable systemd-resolved name server stub. You can use this command to do this:

# This just changes "#DNSStubListener=yes" to "DNSStubListener=no"
sudo sed -r -i.orig 's/#?DNSStubListener=yes/DNSStubListener=no/g' /etc/systemd/resolved.conf

You also have to remove the symlink /etc/resolv.conf, and replace it with a file:

rm /etc/resolv.conf
echo "nameserver 1.1.1.1" >  /etc/resolv.conf
echo "nameserver 8.8.8.8" >> /etc/resolv.conf

Then do systemctl restart systemd-resolved. ( Source)

run pi-hole in docker-compose  

I am using this docker-compose.yml file for pi-hole:

version: "3"

# More info at https://github.com/pi-hole/docker-pi-hole/ and https://docs.pi-hole.net/
services:
  pihole:
    container_name: pihole
    image: pihole/pihole:latest

    ports:
      - "53:53/tcp"
      - "53:53/udp"
      - "67:67/udp"
      - "80:80/tcp"

    environment:
      ServerIP: "192.168.1.2"     # ADJUST FOR YOUR PI-HOLE IP OF COURSE
      TZ: 'Europe/Berlin'
      WEBPASSWORD: 'mysupersecretpassword'

    volumes:
      - './data/etc-pihole/:/etc/pihole/'
      - './data/etc-dnsmasq.d/:/etc/dnsmasq.d/'

    dns:                          # THIS IS IMPORTANT
      - 127.0.0.1                 # SPECIALLY THIS LINE. I DON'T KNOW WHY.
      - 172.198.179.1

    # Recommended but not required (DHCP needs NET_ADMIN)
    #   https://github.com/pi-hole/docker-pi-hole#note-on-capabilities
    cap_add:
      - NET_ADMIN

    restart: unless-stopped

Update pi-hole entries  

Then update the pi-hole when it runs under: WebUI -> Tools -> Update Gravity -> Press “Update”.

 Add swap space in Ubuntu
Proxmox and home assistant 
On this page:
  • disable systemd-resolved stub
  • run pi-hole in docker-compose
  • Update pi-hole entries
In case you want to follow me

Here are some links. The further to the right, the less active.

           
(c) Axel Bock | Powered by Hinode.
Code copied to clipboard