[GH-ISSUE #211] Does not do anything on Ubuntu 20.04 #86

Closed
opened 2026-02-26 04:34:00 +03:00 by kerem · 7 comments
Owner

Originally created by @stam on GitHub (Sep 30, 2020).
Original GitHub issue: https://github.com/mageddo/dns-proxy-server/issues/211

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:

Originally created by @stam on GitHub (Sep 30, 2020). Original GitHub issue: https://github.com/mageddo/dns-proxy-server/issues/211 ### 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](https://github.com/mageddo/dns-proxy-server/files/5308346/docker-version.txt) - DPS Version: 2.19.0 - Please attach DPS Log file: [dps.log](https://github.com/mageddo/dns-proxy-server/files/5308337/dps.log)
kerem 2026-02-26 04:34:00 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@ketilkn commented on GitHub (Nov 30, 2020):

@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.

<!-- gh-comment-id:735774903 --> @ketilkn commented on GitHub (Nov 30, 2020): @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.
Author
Owner

@johncadengo commented on GitHub (Dec 2, 2020):

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."

<!-- gh-comment-id:737527838 --> @johncadengo commented on GitHub (Dec 2, 2020): 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."
Author
Owner

@johncadengo commented on GitHub (Dec 2, 2020):

@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

<!-- gh-comment-id:737551204 --> @johncadengo commented on GitHub (Dec 2, 2020): @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
Author
Owner

@mageddo commented on GitHub (Mar 2, 2023):

@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

<!-- gh-comment-id:1452295903 --> @mageddo commented on GitHub (Mar 2, 2023): @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
Author
Owner

@mageddo commented on GitHub (Mar 2, 2023):

@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

<!-- gh-comment-id:1452297586 --> @mageddo commented on GitHub (Mar 2, 2023): @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
Author
Owner

@mageddo commented on GitHub (Mar 2, 2023):

@johncadengo

I am running into this behavior as well. Any fixes?

Yep, it's fixed for now

<!-- gh-comment-id:1452299975 --> @mageddo commented on GitHub (Mar 2, 2023): @johncadengo > I am running into this behavior as well. Any fixes? Yep, it's fixed for now
Author
Owner

@mageddo commented on GitHub (Mar 3, 2023):

I'm closing this but feel free to reopen if you need

<!-- gh-comment-id:1453375309 --> @mageddo commented on GitHub (Mar 3, 2023): I'm closing this but feel free to reopen if you need
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/dns-proxy-server-mageddo#86
No description provided.