Dhcp on docker desktop via dhcp relay

The issue I am facing: trying to use dhcp relay as documented here https://docs.pi-hole.net/docker/DHCP/ , but using up to date variables. Right now, with the below files in their proper locations according to this guide, if i turn dhcp on (first turning off my gateway dhcp) and try to release and renew my windows 11 laptop, pi hole diagnosis says no address range available for DHCP request via 127.0.0.1. So I feel like I am close and have a slight misconfiguration. any help or insight would be appreciated.

Details about my system: Docker Desktop and WSL2

What I have changed since installing Pi-hole:

docker-compose.yaml
services:
pihole:
container_name: pihole
image: pihole/pihole:latest

ports:
\- "53:53/tcp"
\- "53:53/udp"
\- "80:80/tcp"
\- "443:443/tcp"
\# - "67:67/udp"
\# - 5335:5335/tcp # Uncomment to enable unbound access on local server
\# - 22/tcp # Uncomment to enable SSH

environment:
TZ: America/Chicago
FTLCONF_webserver_api_password: redacted
FTLCONF_dns_dnssec: true
FTLCONF_dns_listeningMode: all

volumes:
\- etc-pihole:/etc/pihole
\- etc-dnsmasq.d:/etc/dnsmasq.d

restart: no
cap_add:
\- NET_ADMIN
\# - SYS_MODULE
\- SYS_TIME
\- SYS_NICE

\# sysctls:
\#   - net.ipv4.ip_forward=1
\#   - net.ipv4.conf.all.src_valid_mark=1

networks:
wg:
ipv4_address:  '10.42.42.43'

dhcphelper:
build:  ./dhcp-helper
restart:  no
network_mode:  host
command:  -s 10.42.42.43

cap_add:
\- NET_ADMIN

volumes:
etc-pihole:
etc-dnsmasq.d:

networks:
wg:
name: wg
external: true
Dockerfile
FROM alpine:latest
RUN apk --no-cache add dhcp-helper
EXPOSE 67 67/udp
ENTRYPOINT \["dhcp-helper", "-n"\]
07-dhcp-options.conf
dhcp-option=option:dns-server,10.42.42.43

Where did you put this file? Make sure the file is on the correct directory before start the container.

Also,by default Pi-hole v6 doesn't load files from /etc/dnsmasq.d.

If you are adding custom files to /etc/dnsmasq.d , you need to enable the corresponding option (misc.etc_dnsmasq_d) in Pi-hole settings.

Add this environment variable to Pi-hole compose file:

  environment:
    FTLCONF_misc_etc_dnsmasq_d: true

fair question haha. yeah i figured out where it was while the container was running. lots of things i am learning by jumping into pi hole. haha. i could probably make my life a little easier by using a path straight from one of my windows drives but … eh. I don’t mind digging into linux. this is all very interesting as my first real foray into using linux. I am adding that variable and re-reading the guide. i think i either that will do the trick or i need to change the ip address to the actual ip of the windows box on my lan. we shall see!

Just one note:

It would make your life a lot easier if you run Pi-hole container in a Linux machine.

Docker Desktop runs inside a VM with certain restrictions, so your container will run inside docker, that runs inside a VM, that runs in Windows... too many network layers that will unnecessarily increase the complexity.

1 Like

ah yes but we are human and stubborn. i’m headed that direction though. i have a laptop that had its battery removed so its effectively a desktop computer. starting to look at what i have on its drives and thinking about dual booting ubuntu. appreciate the advice. i might just make it the dhcp and put unbound on it too.

This seems like a Docker issue rather than a Pi-hole one:

You are trying to run one of your containers in host network mode, which needs to be explicitly enabled for Docker Desktop (and also isn't supported in Docker Desktop versions older than 4.34), see Host network driver | Docker Docs.

yeah i found that in docker desktop and enabled it. i’m on the latest version.

i’ve been working on this for a week so i am just going to get linux on a laptop and see who has an old laptop they don’t want for a second one. plan to run unbound on both and try using them as my dns servers.

Why not get an old Intel Atom NUC instead of Laptop hardware that can go in Sleep Mode and all the other Battery Saving states that can give you a lot of unnecessary issues ?

I have seen people giving them away for FREE with a SSD and some RAM inside :wink:

well i got all the sleep states disabled and xrdp working with changes made to add gnome and make gnome look like the default ubuntu install so, I am good for now. there is an oddity with getting the laptop screen to wakeup but that doesnt matter now that i can just use rdp from my windows machine.

edit: and yes i quickly learned you have to be logged out for vnc or xrdp. :grinning_face_with_smiling_eyes: …. and that xrdp default look is close but not quite what i expected it to be upon first login.

edit2: my opinion but tightvnc is ugly.

edit3: back on topic: docker-ce has been installed and I successfully avoided the temptation to use docker-desktop. am excited to get pi-hole dhcp working soon!

boom! found all the puzzle pieces. i will create another post to document when i am up and running. thanks all.