dnsmasq service runing in docker container
Explore the docs »
View Demo
·
Report Bug
·
Request Feature
.
Docker Page
To run your local dns server with your custom domain with dnsmasq in docker follow these simple steps.
-
Pull the image.
docker pull zer0power/dnsmasq
-
Create and run the docker container, Change
YOUR-HOSTS-PATH
to your host list in my case is/opt/docker/volumes/dnsmasq/list
, ChangeYOUR-CONFIG-addn-hosts
to your configaddn-hosts
path in this case is/opt/list
, ReplaceYOUR-CONFIG-PATH
to yourdnsmasq.conf
path in your host.
Note : create your host list before mounting volume ,exmp: touch /opt/docker/volumes/dnsmasq/list
docker run -itd --name dnsmasq --hostname dns -p 53:53/udp -v YOUR-HOSTS-PATH:YOUR-CONFIG-addn-hosts -v YOUR-CONFIG-PATH:/etc/dnsmasq.conf zer0power/dnsmasq
Note : if you want to build image your self follow these steps then do step 2. -
Clone this repository.
git clone https://github.com/Zer0Power/dnsmasq.git
-
Build image, Replace
IMAGE_NAME
with whatever you like andIMAGE-TAG
.docker build -t IMAGE-NAME:IMAGE-TAG ./
To be able to run the dnsmasq, you will need a configuration file. This is a basic example.
#Log All DNS Quieries
log-queries
log-async
#Define Host list
addn-hosts=/opt/list
#Set Cache
cache-size=10000
#Never Forward Plain Names
domain-needed
#Prevent Forwarding Dns Reverse Queries To Upstream
bogus-priv
#Ignore /etc/resolv.conf
no-resolv
#Add Domain To HostNames
#expand-hosts
#Domain To Be Added If `expand-host` Is Set
#domain=zero.lan
#Local Domain To Be Served From Host List
local=/zero.lan/
#Set Dns Resolvers
server=8.8.8.8
server=1.1.1.1
server=8.8.4.4