Sign inSign up

gkweb76/dhcp

By gkweb76

•Updated over 8 years ago

DHCP container based on Alpine Linux.

Image
0

980

gkweb76/dhcp repository overview

⁠Supported tags

⁠What is DHCP

DHCP is a well know service allowing you to serve IP addresses and network information (DNS, gateway, etc.) to your LAN.

⁠Why using this image ?

This image is a vanilla DHCP software without any additional packages installed.

This image is based on Alpine Linux⁠. Alpine Linux is generally immune to vulnerabilities targetting components not installed in this Operating System, such as: bash (e.g. Shellshock vulnerability), OpenSSL (e.g. Heartbleed vulnerability), glibc (e.g Ghost vulnerability). Also, Alpine Linux has a much smaller image size compared to other OS thanks to less packages installed by default and not relying on glibc, providing faster image download, and reduced attack surface, hence better security.

⁠Maintained by

Guillaume Kaddouch
Blog: https://networkfilter.blogspot.com/⁠
Twitter: @gkweb76⁠
Github: gkweb76⁠

⁠How to use this image from command line

First create your volumes:
docker volume create dhcp
docker volume create dhcp_leases
docker volume inspect dhcp | grep Mount
Grab the host real path, for instance /var/lib/docker/volumes/dhcp/_data (referred as '$DHCP_VOLUME_PATH' below)

Then copy your dhcpd.conf there, using the correct path:
cp ./dhcpd.conf $DHCP_VOLUME_PATH

Apply a strict chmod so that only root can modify these files:
chmod 644 $DHCP_VOLUME_PATH/dhcpd.conf

Finally start your container:
-> modify the eth0 interface at the end to match your interface name
docker container run --rm -v dhcp:/etc/dhcp -v dhcp_leases:/var/lib/dhcp --net=host \
--read-only=true --tmpfs /run/dhcp -p 67:67/udp --name dhcp gkweb76/dhcp \
/usr/sbin/dhcpd -4 -d -cf /etc/dhcp/dhcpd.conf eth0

⁠Docker compose example

version: "3.5"

services:
   dhcp:
   image: gkweb76/dhcp:latest
   container_name: dhcp
   read_only: yes
   network_mode: "host"
   volumes:
     - dhcp:/etc/dhcp # put your conf files here
     - dhcp_leases:/var/lib/dhcp
     - /etc/localtime:/etc/localtime:ro # keep container clock in sync with host
   tmpfs:
     - /run/dhcp
   command: ["/usr/sbin/dhcpd", "-4", "-d", "-cf", "/etc/dhcp/dhcpd.conf", "eth0"] # specify your host LAN interface
   restart: "unless-stopped"

# Volumes declaration
volumes:
   dhcp:
   dhcp_leases:

If you need help with your compose file, check the official documentation⁠.

⁠Tested on

Ubuntu⁠ 18.04 LTS and Docker 18.04.0 CE (Community Edition).

⁠License

MIT License

Tag summary

Content type

Image

Digest

Size

3.5 MB

Last updated

over 8 years ago

docker pull gkweb76/dhcp