Sign inSign up

alfieri/dnsmasq

By alfieri

•Updated about 5 years ago

Small and simple DNS Server with dnsmasq and docker

Image
1

1.1K

alfieri/dnsmasq repository overview

⁠dnsmasq Service with Docker Alpine

GitHub issues GitHub license GitHub stars

docker build docker build image size layers docker pulls docker Stars

Small and simple DNS Server with dnsmasq and docker

⁠Info

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⁠

⁠Supported Architectures
ArchitectureTag
x86-64latest
arm64arm64v8-latest
armhfarm32v6-latest

Special thanks to Ricardo Amaral⁠ and his solution for multi arch build for Docker Hub on Stack Overflow. You will find this here⁠

⁠Usage

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 CLI
  1. pull the image docker pull alfieri/dnsmasq
  2. create the container
docker 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
  1. start the created dnsmasq container docker start dnsmasq. If it raises an error see the troublshoot section for help.
⁠Docker Compose
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

⁠Troublshoot

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

Tag summary

Content type

Image

Digest

Size

2.9 MB

Last updated

over 5 years ago

docker pull alfieri/dnsmasq