|
| 1 | +Docker image for ISC DHCP server |
| 2 | +================================ |
| 3 | + |
| 4 | +This Docker image is suitable for running a DHCP server for your docker host |
| 5 | +network. It uses ISC DHCP server which is bundled with the latest Ubuntu |
| 6 | +LTS distribution. |
| 7 | + |
| 8 | +How to build |
| 9 | +============ |
| 10 | + |
| 11 | + 1. Install Docker with the instructions on <https://www.docker.com>. |
| 12 | + 2. Run `./build` to create the local image `dhcpd`. |
| 13 | + |
| 14 | +How to use |
| 15 | +========== |
| 16 | + |
| 17 | +The most common use-case is to provide DHCP service to the host network of |
| 18 | +the machine running Docker. For that you need to create a configuration for |
| 19 | +the DHCP server, start the container with the `--net=host` docker run |
| 20 | +option and specify the network interface you want to provide DHCP service |
| 21 | +on. |
| 22 | + |
| 23 | + 1. Create `data` folder. |
| 24 | + 2. Create `data/dhcpd.conf` with a subnet clause for the specified |
| 25 | + network interface. If you need assistance, you can run |
| 26 | + `docker run -it --rm dhcpd man dhcpd.conf` for a description of |
| 27 | + the configuration file syntax. |
| 28 | + 3. Run `docker -it --rm --net=host -v "$(pwd)/data":/data dhcpd eth0`. |
| 29 | + `dhcpd` will automatically start and display its logs on the console. |
| 30 | + You can press Ctrl-C to terminate the server. |
| 31 | + |
| 32 | +A simple `run` script is also included which makes it quick to iterate on a |
| 33 | +configuration until you're satisfied. |
| 34 | + |
| 35 | +Notes |
| 36 | +===== |
| 37 | + |
| 38 | +The entrypoint script in the docker image takes care of running the DHCP |
| 39 | +server as the same user that owns the `data` folder. This ensures that the |
| 40 | +permissions on the files inside the `data` folder is kept consistent. If |
| 41 | +the `data` folder is owned by root, dhcpd is run as the normal dhcpd user. |
| 42 | + |
| 43 | +If you forget to run the docker container with the `--net=host` option a |
| 44 | +warning will be emitted informing you that you've probably forgotten it. |
| 45 | + |
| 46 | +If a `/data` volume is not provided with a `dhcpd.conf` inside it, the |
| 47 | +container will exit early with an error message. |
| 48 | + |
| 49 | +Acknowledgements |
| 50 | +================ |
| 51 | + |
| 52 | +This image uses the following software components: |
| 53 | + |
| 54 | + * Ubuntu Linux distribution from <https://www.ubuntu.com>. |
| 55 | + * ISC DHCP server from <https://www.isc.org/downloads/dhcp/>. |
| 56 | + * Docker-optimized my_init from <https://github.com/phusion/baseimage-docker>. |
| 57 | + |
| 58 | +Copyright & License |
| 59 | +=================== |
| 60 | + |
| 61 | +This project is copyright 2015 Robin Smidsrød <[email protected]>. |
| 62 | + |
| 63 | +It is licensed under the Apache 2.0 license. |
| 64 | + |
| 65 | +See the file LICENSE for full legal details. |
0 commit comments