Skip to content

Alfieri/dnsmasq-docker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

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

Additional Links

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

About

Small and simple DNS Server with dnsmasq and docker

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published