Small and simple DNS Server with dnsmasq and docker
1.1K
Small and simple DNS Server with dnsmasq and docker
Dnsmasq provides network infrastructure for small networks: DNS, DHCP, router advertisement and network boot. It is designed to be lightweight...
from http://www.thekelleys.org.uk/dnsmasq/doc.html
| Architecture | Tag |
|---|---|
| x86-64 | latest |
| arm64 | arm64v8-latest |
| armhf | arm32v6-latest |
Special thanks to Ricardo Amaral and his solution for multi arch build for Docker Hub on Stack Overflow. You will find this here
There are two volumes to map. The /etc/dnsmasq/ volume is for the two config files for configure local hosts and nameservers (see example-hosts.conf and example-nameservers.conf). The /etc/dnsmasq.d/ is the standard config directory for confiugre additional stuff for dnsmasq.
The dnsmasq start is created as Entrypoint so any additinal commandline parameter are passed through. So you can ether configure dnsmasq via commandline or via the /etc/dnsmasq.d/ volume.
Important: dnsmasq requires the NET_ADMIN capabilities to run.
docker pull alfieri/dnsmasqdocker create --name dnsmasq --cap-add=NET_ADMIN \
-p 53:53/tcp -p 53:53/udp \
-v <host_dir>:/etc/dnsmasq -v <host_dir>:/etc/dnsmasq.d \
alfieri/dnsmasq
docker start dnsmasq. If it raises an error see the troublshoot section for help.version: "3.4"
services:
dnsmasq:
image: alfieri/dnsmasq:latest
restart: always
ports:
- "53:53/tcp"
- "53:53/upd"
volumes:
- "<your config path here>:/etc/dnsmasq"
cap_add:
- NET_ADMIN
If an error raises with something like this message
... listen 0.0.0.0:53: bind: address already in use
try to bind the docker port mappings to the exakt ip of the host like this -p 123.456.789.111:53:53
Content type
Image
Digest
Size
2.9 MB
Last updated
over 5 years ago
docker pull alfieri/dnsmasq