Public | Automated Build

Last pushed: 3 days ago
Short Description
This Docker image is suitable for running a DHCP server for your docker host network.
Full Description

Docker image for ISC DHCP server

This Docker image is suitable for running a DHCP server for your docker host
network. It uses ISC DHCP server which is bundled with the latest Ubuntu
LTS distribution.

How to build

  1. Install Docker with the instructions on https://www.docker.com.
  2. Run ./build to create the local docker image networkboot/dhcpd.

How to use

The most common use-case is to provide DHCP service to the host network of
the machine running Docker. For that you need to create a configuration for
the DHCP server, start the container with the --net=host docker run
option and specify the network interface you want to provide DHCP service
on.

  1. Create data folder.
  2. Create data/dhcpd.conf with a subnet clause for the specified
    network interface. If you need assistance, you can run
    docker run -it --rm networkboot/dhcpd man dhcpd.conf for a description
    of the configuration file syntax.
  3. Run docker run -it --rm --net=host -v "$(pwd)/data":/data networkboot/dhcpd eth0.
    dhcpd will automatically start and display its logs on the console.
    You can press Ctrl-C to terminate the server.

A simple run script is also included which makes it quick to iterate on a
configuration until you're satisfied.

Notes

The entrypoint script in the docker image takes care of running the DHCP
server as the same user that owns the data folder. This ensures that the
permissions on the files inside the data folder is kept consistent. If
the data folder is owned by root, dhcpd is run as the normal dhcpd user.

If you forget to run the docker container with the --net=host option a
warning will be emitted informing you that you've probably forgotten it.

If a /data volume is not provided with a dhcpd.conf inside it, the
container will exit early with an error message.

Acknowledgements

This image uses the following software components:

Copyright & License

This project is copyright 2017 Robin Smidsrød robin@smidsrod.no.

It is licensed under the Apache 2.0 license.

See the file LICENSE for full legal details.

Docker Pull Command
Owner
networkboot
Source Repository

Comments (7)
gadieichhorn
3 months ago

getting an error on widnows 10 powershell
groupmod: GID '50' already exists

any idea what it is?

robinsmidsrod
9 months ago

The python3 issue mentioned in comments was fixed July 19th 2016. See https://github.com/networkboot/docker-dhcpd/issues/1 for details.

neoul
a year ago

/entrypoint.sh: /sbin/my_init: /usr/bin/python3: bad interpreter: No such file or directory

To fix this error, Python3 interpreter seems be installed upon the build.

FROM ubuntu

MAINTAINER Robin Smidsrød robin@smidsrod.no

RUN apt-get -q -y update \
&& apt-get -q -y -o "DPkg::Options::=--force-confold" -o "DPkg::Options::=--force-confdef" dist-upgrade \
&& apt-get -q -y -o "DPkg::Options::=--force-confold" -o "DPkg::Options::=--force-confdef" install isc-dhcp-server man \
&& apt-get -q -y autoremove \
&& apt-get -q -y clean

RUN apt-get -q -y install python3
RUN rm -rf /var/lib/apt/lists/*

COPY util/my_init.py /sbin/my_init
COPY util/entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]

richardpayne
a year ago

I'm seeing the bad interpreter issue too. Anything I can do to help identify it?

robinsmidsrod
a year ago

@trurlmcbyte I'm not able to reproduce your bug. Could you please file an issue here? https://github.com/networkboot/docker-dhcpd/issues

trurlmcbyte
a year ago

/entrypoint.sh: /sbin/my_init: /usr/bin/python3: bad interpreter: No such file or directory