Create a file called Dockerfile wherever you like.
Save it. Make sure it is just called Dockerfile.
FROM ubuntu:noble
# install isc-dhcp-server non-interactively and clean up apt lists
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y isc-dhcp-server \
&& rm -rf /var/lib/apt/lists/*
# copy your dhcp configuration into the image
COPY dhcpd.conf /etc/dhcp/dhcpd.conf
# configure which interface dhcpd listens on (adjust eth0 as needed)
RUN sed -i 's/^INTERFACESv4=".*"/INTERFACESv4="eth0"/' /etc/default/isc-dhcp-server
# expose DHCP port
EXPOSE 67/udp
# run dhcpd in foreground with debug logging
CMD ["dhcpd", "-f", "-d", "-cf", "/etc/dhcp/dhcpd.conf"]
docker build -t ubuntu-noble-dhcp .
docker run -d --name dhcp-server --privileged --net=host ubuntu-noble-dhcp