dns-proxy-server
dns-proxy-server copied to clipboard
Does not do anything on Ubuntu 20.04
What is Happening
Running on Ubuntu 20.04, host cannot lookup hostname of docker containers
What is expected
On the host machine running nslookup nginx.docker should work, but it returns:
Server: 127.0.0.53
Address: 127.0.0.53#53
** server can't find nginx.docker: NXDOMAIN
Steps to Reproduce
First I run: docker run --hostname dns.mageddo --restart=unless-stopped
-v /var/run/docker.sock:/var/run/docker.sock
-v /etc/resolv.conf:/etc/resolv.conf
defreitas/dns-proxy-server
Also I run: docker run --rm --hostname nginx.docker nginx
Afterwards I try the nslookup also on the host machine.
Specs:
- OS: Ubuntu 20.04.1 LTS
- Docker Version: docker-version.txt
- DPS Version: 2.19.0
- Please attach DPS Log file: dps.log
@stam There is a hint in /etc/resolv.conf
# This file is managed by man:systemd-resolved(8). Do not edit.
#
# This is a dynamic resolv.conf file for connecting local clients to the
# internal DNS stub resolver of systemd-resolved. This file lists all
# configured search domains.
#
# Run "resolvectl status" to see details about the uplink DNS servers
# currently in use.
#
# Third party programs must not access this file directly, but only through the
# symlink at /etc/resolv.conf. To manage man:resolv.conf(5) in a different way,
# replace this symlink by a static file or a different symlink.
#
# See man:systemd-resolved.service(8) for details about the supported modes of
# operation for /etc/resolv.conf.
Specifically: To manage man:resolv.conf(5) in a different way, replace this symlink by a static file or a different symlink.
So what you can do is delete the symlink in etc and copy the current contents from the original source
rm /etc/resolv.conf
cp /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf
This will slightly mess up your system, so you should probably revert the change by recreating the symlink once you are done
rm /etc/resolv.conf
ln -s /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf`
There may very well be a better way to go about this.
I am running into this behavior as well. Any fixes? I'm not too sure about trying something that involves the statement "This will slightly mess up your system."
@stam a DNS proxy server seems like a more elegant solution, which is why I was trying to get this to work. However, like you, I ran into issues with it working in Ubuntu 20.
So I found a workaround, using the hosts file. If you're still running into this problem, I got this up and running within minutes: https://github.com/dvddarias/docker-hoster
@ketilkn
There is a hint in /etc/resolv.conf ....
yeah, since DPS 3.5.2 it will prefer to configure using systemd-resolved when avaible, give it a try
@stam
Running on Ubuntu 20.04, host cannot lookup hostname of docker containers....
DPS is crashing right on the start, I also had this issue, looks to be fixed at 3.5.2, give it a try
@johncadengo
I am running into this behavior as well. Any fixes?
Yep, it's fixed for now
I'm closing this but feel free to reopen if you need