Simple and lightweight ISC DHCP server container based on Alpine Linux.
1.1K
Simple and lightweight DHCP server based on ISC DHCP and the Alpine Linux image.
Below is an example of a dhcpd.conf file. Adjust it as needed. In this example:
# dhcpd.conf file
authoritative;
# Lease time in seconds
default-lease-time 3588;
max-lease-time 7200;
# Subnet
subnet 192.168.86.0 netmask 255.255.255.0 {
option routers 192.168.86.1;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.86.255;
option domain-name-servers 192.168.86.1, 8.8.8.8;
range 192.168.86.100 192.168.86.250;
# Set the network domain
option domain-name "my-domain.com";
# Static IPs outside the range above
host MacBook-Sales { hardware ethernet 70:3A:CB:D8:70:40; fixed-address 192.168.86.12; }
host Laptop-Hospital { hardware ethernet 44:2C:05:4B:9C:19; fixed-address 192.168.86.15; }
host Laptop-HR { hardware ethernet 70:3A:CB:D8:70:56; fixed-address 192.168.86.252; }
host Cell-Security { hardware ethernet 70:3A:CB:D8:70:CF; fixed-address 192.168.86.94; }
}
/opt/dhcpd./opt/dhcpd/dhcpd.conf with your configuration and create /opt/dhcpd/dhcpd.leases (it may be empty). Make sure the container can write to it.docker run (examples below).docker logs -f dhcpd.Although Docker Compose is preferred, you can run the container with docker run:
docker run -d --name my-dhcp-server --network host -v /opt/dhcpd:/app --restart=always lseara/dhcpd
Example docker-compose.yml:
services:
dhcpd:
image: lseara/dhcpd
network_mode: host
container_name: dhcpd
restart: unless-stopped
environment:
TZ: 'America/Sao_Paulo'
volumes:
- /opt/dhcpd:/app
Make sure the volume directory (in this example /opt/dhcpd) contains the dhcpd.conf from the example above and a dhcpd.leases file (it may be empty). The container reads /app/dhcpd.conf and writes /app/dhcpd.leases.
Content type
Image
Digest
sha256:63eea1ecc…
Size
5.5 MB
Last updated
over 3 years ago
docker pull lseara/dhcpd