I'm modifying your example above:
version: "3"
services:
pihole:
container_name: pihole_docker
image: pihole/pihole:latest
# For DHCP it is recommended to remove these ports and instead add: network_mode: "host" (or "macvlan")
ports:
- "53:53/tcp"
- "53:53/udp"
- "80:80/tcp"
environment:
TZ: 'Europe/Berlin'
# WEBPASSWORD: 'ChangeMeNow'
# Volumes store your data between container upgrades
volumes:
- './share/Docker/pihole/etc'
- './share/Docker/pihole/dnsmasq'
# https://github.com/pi-hole/docker-pi-hole#note-on-capabilities
restart: always
# THIS IS THE NEW PART - you need to define the network for Pi-hole
networks:
macvlan_network:
ipv4_address: 192.168.178.65
# Here you will declare the network details.
networks:
macvlan_network:
external:
name: macvlan_network # This must be the same name you used when you created the macvlan
You need to know the macvlan name and replace it above.
You can add the environment variable in the compose file (like you did with TZ
and WEBPASSWORD
) to keep all values in one place.
(...)
environment:
TZ: 'Europe/Berlin'
# WEBPASSWORD: 'ChangeMeNow'
# FTLCONF_LOCAL_IPV4: `192.168.178.65` # is just a suggestion
PIHOLE_DNS_: '192.168.178.66' # set your upstream DNS servers
(...)
I'm using PIHOLE_DNS_
here, because DNS1
and DNS2
were deprecated a long time ago.