jderusse / docker-dns-gen Goto Github PK
View Code? Open in Web Editor NEWDNS Server for docker
License: MIT License
DNS Server for docker
License: MIT License
Hello,
I installed this container and it works fine ! Thank you for that.
But now, I want launch automatically this container when host system boot. Do you have a solution or tips ?
Hi, I run container with flag --restart always
but after reboot the dnsmasq not found in process list. My host machine switched to slave dns server and lose all docker hosts.
To reproduce this issue just do:
docker stop dns-gen
docker start dns-gen
docker top dns-gen #you can see only sh and docker-gen process
I think it's require more flexible process management, something like supervisord but more lightweight, I found alternatives wtiren on Go: https://github.com/codeskyblue/gosuv and http://governator.io/
Would very much like to try your product, but can't seem to find a license. Can you add a LICENSE
file? Thanks.
Hi, I'm using this and for some reason, every now and then, the container stops listening on port 53 and I have to restart it to make it work. Checking the container logs, I see a message being output every second or so that reads
sed: no previous regexp
Any idea what could it be or how to fix it?
Thanks!
Hi, unfortunately I don't have the time to create a PR but in case anyone wants to get this running on Fedora, here's a how to guide.
GATEWAY=$(ip -4 addr show docker0 | grep -oP '(?<=inet\s)\d+(\.\d+){3}')
echo ${GATEWAY}
to make sure the gateway address is found.docker run -d --name dns-gen \
--restart always \
--net host \
-e GATEWAY=$GATEWAY \
--log-opt "max-size=10m" \
--volume /:/host \
--volume /var/run/docker.sock:/var/run/docker.sock \
jderusse/dns-gen:2
sudo mkdir /etc/systemd/resolved.conf.d
since in my installation the folder did not exist.sudo vi /etc/systemd/resolved.conf.d/docker-dns.conf
[Resolve]
DNS=...
sudo systemctl restart systemd-resolved.service
systemd-analyze cat-config systemd/resolved.conf
It should now work, you can start a nginx container:
docker run -d --rm --name test nginx:alpine
dig test.docker @${GATEWAY}
dig test.docker
Everything should work now.
I deployed this in a server, and I also deployed an ipsec vpn server When I connect to the VPN, and use 172.17.0.1 a DNS server, the dns server works for seconds, than stops responding.
I'm not good with networking, but I thought it could be an ufw or iptables issue, so I ran this command netstat -tulpn
and I found a lot of udp ports oppened by dnsmasq
Here is what it shows Me
root@server:~# netstat -tulpn | grep dnsmasq
tcp 0 0 172.17.0.1:53 0.0.0.0:* LISTEN 1619759/dnsmasq
udp 0 0 0.0.0.0:1079 0.0.0.0:* 1619759/dnsmasq
udp 0 0 0.0.0.0:34132 0.0.0.0:* 1619759/dnsmasq
udp 0 0 0.0.0.0:34430 0.0.0.0:* 1619759/dnsmasq
udp 0 0 0.0.0.0:1696 0.0.0.0:* 1619759/dnsmasq
udp 0 0 0.0.0.0:34504 0.0.0.0:* 1619759/dnsmasq
udp 0 0 0.0.0.0:2352 0.0.0.0:* 1619759/dnsmasq
udp 0 0 0.0.0.0:35495 0.0.0.0:* 1619759/dnsmasq
udp 0 0 0.0.0.0:2979 0.0.0.0:* 1619759/dnsmasq
udp 0 0 0.0.0.0:3575 0.0.0.0:* 1619759/dnsmasq
udp 0 0 0.0.0.0:36395 0.0.0.0:* 1619759/dnsmasq
udp 0 0 0.0.0.0:36670 0.0.0.0:* 1619759/dnsmasq
udp 0 0 0.0.0.0:4765 0.0.0.0:* 1619759/dnsmasq
udp 0 0 0.0.0.0:38233 0.0.0.0:* 1619759/dnsmasq
udp 0 0 0.0.0.0:38850 0.0.0.0:* 1619759/dnsmasq
udp 0 0 0.0.0.0:6292 0.0.0.0:* 1619759/dnsmasq
udp 0 0 0.0.0.0:40249 0.0.0.0:* 1619759/dnsmasq
udp 0 0 0.0.0.0:7619 0.0.0.0:* 1619759/dnsmasq
udp 0 0 0.0.0.0:41246 0.0.0.0:* 1619759/dnsmasq
udp 0 0 0.0.0.0:41793 0.0.0.0:* 1619759/dnsmasq
udp 0 0 0.0.0.0:43112 0.0.0.0:* 1619759/dnsmasq
udp 0 0 0.0.0.0:10632 0.0.0.0:* 1619759/dnsmasq
udp 0 0 0.0.0.0:43955 0.0.0.0:* 1619759/dnsmasq
udp 0 0 0.0.0.0:45326 0.0.0.0:* 1619759/dnsmasq
udp 0 0 0.0.0.0:45515 0.0.0.0:* 1619759/dnsmasq
udp 0 0 0.0.0.0:46562 0.0.0.0:* 1619759/dnsmasq
udp 0 0 0.0.0.0:14707 0.0.0.0:* 1619759/dnsmasq
udp 0 0 0.0.0.0:47606 0.0.0.0:* 1619759/dnsmasq
udp 0 0 0.0.0.0:15110 0.0.0.0:* 1619759/dnsmasq
udp 0 0 0.0.0.0:48411 0.0.0.0:* 1619759/dnsmasq
udp 0 0 0.0.0.0:15957 0.0.0.0:* 1619759/dnsmasq
udp 0 0 0.0.0.0:48793 0.0.0.0:* 1619759/dnsmasq
udp 0 0 0.0.0.0:16082 0.0.0.0:* 1619759/dnsmasq
udp 0 0 0.0.0.0:16200 0.0.0.0:* 1619759/dnsmasq
udp 0 0 0.0.0.0:16243 0.0.0.0:* 1619759/dnsmasq
udp 0 0 0.0.0.0:16255 0.0.0.0:* 1619759/dnsmasq
udp 0 0 0.0.0.0:49337 0.0.0.0:* 1619759/dnsmasq
udp 0 0 0.0.0.0:49658 0.0.0.0:* 1619759/dnsmasq
udp 0 0 0.0.0.0:49768 0.0.0.0:* 1619759/dnsmasq
udp 0 0 0.0.0.0:50477 0.0.0.0:* 1619759/dnsmasq
udp 0 0 0.0.0.0:18003 0.0.0.0:* 1619759/dnsmasq
udp 0 0 0.0.0.0:21018 0.0.0.0:* 1619759/dnsmasq
udp 0 0 0.0.0.0:54104 0.0.0.0:* 1619759/dnsmasq
udp 0 0 0.0.0.0:56667 0.0.0.0:* 1619759/dnsmasq
udp 0 0 0.0.0.0:57025 0.0.0.0:* 1619759/dnsmasq
udp 0 0 0.0.0.0:58336 0.0.0.0:* 1619759/dnsmasq
udp 0 0 0.0.0.0:59052 0.0.0.0:* 1619759/dnsmasq
udp 0 0 0.0.0.0:60122 0.0.0.0:* 1619759/dnsmasq
udp 0 0 0.0.0.0:27414 0.0.0.0:* 1619759/dnsmasq
udp 0 0 0.0.0.0:60547 0.0.0.0:* 1619759/dnsmasq
udp 0 0 0.0.0.0:27894 0.0.0.0:* 1619759/dnsmasq
udp 0 0 0.0.0.0:61420 0.0.0.0:* 1619759/dnsmasq
udp 0 0 0.0.0.0:28773 0.0.0.0:* 1619759/dnsmasq
udp 0 0 0.0.0.0:62413 0.0.0.0:* 1619759/dnsmasq
udp 0 0 0.0.0.0:62644 0.0.0.0:* 1619759/dnsmasq
udp 0 0 0.0.0.0:62996 0.0.0.0:* 1619759/dnsmasq
udp 0 0 0.0.0.0:30273 0.0.0.0:* 1619759/dnsmasq
udp 0 0 0.0.0.0:30824 0.0.0.0:* 1619759/dnsmasq
udp 0 0 0.0.0.0:31150 0.0.0.0:* 1619759/dnsmasq
udp 0 0 0.0.0.0:31515 0.0.0.0:* 1619759/dnsmasq
udp 0 0 0.0.0.0:64713 0.0.0.0:* 1619759/dnsmasq
udp 0 0 0.0.0.0:64720 0.0.0.0:* 1619759/dnsmasq
udp 0 0 0.0.0.0:32251 0.0.0.0:* 1619759/dnsmasq
udp 0 0 0.0.0.0:65066 0.0.0.0:* 1619759/dnsmasq
udp 30720 0 172.17.0.1:53 0.0.0.0:* 1619759/dnsmasq
udp 0 0 0.0.0.0:33067 0.0.0.0:* 1619759/dnsmasq
Can you please, help Me or direct Me or give Me ideas, why this could be happening ?
When the resolv.conf change on the host (ie: network switched, vpn started or stop, ...) the container keep old DNS servers.
Trying to call an old server may cause timeout. It's not an issue, given the host resolver will fallback to the next nameServer, but it will slow down the DNS resolution.
A solution could be to synchronize /etc/resolv.conf beteween host and container.
Beware to not include the IP of the container (127.0.0.1, docker0, or containerIP) in the list of nameServers
Hi @jderusse,
I am looking for help in running dns-gen container in Ubuntu 20.04 OS as detailed below:
docker images | grep dns
jderusse/dns-gen latest 66c9f77b33ec 6 weeks ago 16.9MB
When the container is up and running logs show below msg :
Received event start for container 6dfc415dbde3
2022/11/09 20:17:51 Generated '/etc/dnsmasq.conf' from 2 containers
2022/11/09 20:17:51 Running 'dnsmasq-reload -u root '
2022/11/09 20:17:51 Error running notify command: dnsmasq-reload -u root , exit status 2
2022/11/09 20:17:51 Contents of /etc/dnsmasq.conf did not change. Skipping notification 'dnsmasq-reload -u root '
chroot: can't change root directory to '/host': No such file or directory
sed: /host: No such file or directory
Any clue about the root cause or a work around to fix this?
Akash
Right now to make two domains i add two same images of apache with different service names in docker-compose.yml. Is there any other possibility to not spawn extra instances of apache?
Now:
version: "2"
services:
host1:
image: lordius/alpine-apache
links:
......
host2:
image: lordius/alpine-apache
links:
......
Wanted:
version:` "2"
services:
host1:
image: lordius/alpine-apache
alias: host2
alias: host3
links:
......
Hi !
Really cool app <3
Not really an issue, but I've automated a setup with an ansible playbook which has no dependency and does a complete setup:
https://gist.github.com/jpic/7bfbe20cf759986b7c7c7851c2d63762
Hope this helps somebody ;)
Best
After using dns-gen i was able to access my containers through container.docker . But i realised that i can't ping to www.google.com from my container then i pinged to google's ip
and yes getting response. so i stopped dns-gen container and checked and now my containers are resolving domains (able to ping www.google.com).
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.