Table of Contents | ||
---|---|---|
|
Pre-Requisits
Disable Systemd-Resolved
In order to free up port 53, you may need to disable systemd-resolved on the docker host machine.
sudo su
systemctl stop systemd-resolved
systemctl disable systemd-resolved
Update resolv.conf
vi /etc/resolv.conf
Code Block |
---|
nameserver 127.0.0.1
options edns0
search home |
Install Docker and Docker-Compose
sudo apt-get install docker
sudo apt-get install docker-compose
Installation
Create Docker-Compose Yaml
vi docker-compose.yaml
Code Block |
---|
version: '2' services: pihole: container_name: pihole image: pihole/pihole:latest hostname: pihole domainname: xxx.com # <-- Update mac_address: d0:ca:ab:cd:ef:01 cap_add: - NET_ADMIN networks: pihole_network: ipv4_address: 192.168.1.51 # <-- Update dns: - 127.0.0.1 - 8.8.8.8 ports: - 443/tcp - 53/tcp - 53/udp - 67/udp - 80/tcp environment: ServerIP: 192.168.1.51 # <-- Update (match ipv4_address) VIRTUAL_HOST: pihole.xxx.com # <-- Update (match hostname + domainname) WEBPASSWORD: "xxx" # <-- Add password (if required) restart: unless-stopped volumes: - ./data/pihole:/etc/pihole:rw - ./data/dnsmasq.d:/etc/dnsmasq.d:rw networks: pihole_network: driver: macvlan driver_opts: parent: enp0s25 # <-- Update ipam: config: - subnet: 192.168.1.0/24 # <-- Update gateway: 192.168.1.1 # <-- Update ip_range: 192.168.1.51/32 # <-- Update |
...
Configuration
Forward DNS Requests (If not using DHCP)
If we were not using the DHCP option, we would specify the pi-hole IP address in the list of DNS servers on your router.
DHCP Setup
Enable DHCP
From the pi-hole user interface, go to Settings → DHCP. Here you can enable DHCP and specify static leases.
...