Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LCOW: parse of /etc/resolv.conf failed #35669

Closed
AlekseyMartynov opened this issue Dec 1, 2017 · 3 comments
Closed

LCOW: parse of /etc/resolv.conf failed #35669

AlekseyMartynov opened this issue Dec 1, 2017 · 3 comments
Labels
area/lcow Issues and PR's related to the experimental LCOW feature area/networking status/more-info-needed

Comments

@AlekseyMartynov
Copy link

Using https://github.com/linuxkit/lcow#setup
Server Version: master-dockerproject-2017-11-30

docker run --rm -ti ubuntu bash
apt-get update
apt-get install dnsutils iputils-ping

/etc/resolv.conf has an entry with 2 IPs separated by space which Ubuntu cannot parse

cat /etc/resolv.conf
nameserver 172.28.64.1
nameserver XX.XX.XX.XX YY.YY.YY.YY
search corp.example.com

(XX.XX.XX.XX and YY.YY.YY.YY are LAN DNS servers)

nslookup any
nslookup: parse of /etc/resolv.conf failed
@thaJeztah
Copy link
Member

How are those DNS servers setup? If DNS servers are provided on the daemon, or on docker run (through the --dns flag), each DNS is written to its own line; https://github.com/docker/libnetwork/blob/43f00b74d70e10dcf6adcceb8ead360e10ed49ca/resolvconf/resolvconf.go#L235-L239

$ docker run --rm --dns=8.8.8.8 --dns=8.8.4.4  alpine cat /etc/resolv.conf
nameserver 8.8.8.8
nameserver 8.8.4.4

Trying to pass an invalid IP-address as --dns will produce an error;

$ docker run --rm --dns="8.8.8.8 8.8.4.4"  alpine cat /etc/resolv.conf
invalid argument "8.8.8.8 8.8.4.4" for "--dns" flag: 8.8.8.8 8.8.4.4 is not an ip address
See 'docker run --help'.

However, if no DNS options are provided, a copy of the /etc/resolv.conf from the host is used for the container;

$ docker run --rm alpine cat /etc/resolv.conf
# Generated by dhcpcd from eth0.dhcp
# /etc/resolv.conf.head can replace this line
domain docker.com
nameserver 192.168.65.1
# /etc/resolv.conf.tail can replace this line

The following bind-mounts the host into the container, and checks the host's /etc/resolv.conf, which matches the above output:

$ docker run --rm -v /:/host alpine cat /host/etc/resolv.conf
# Generated by dhcpcd from eth0.dhcp
# /etc/resolv.conf.head can replace this line
domain docker.com
nameserver 192.168.65.1
# /etc/resolv.conf.tail can replace this line

Based on the above, I don't think this is a bug in the moby code-base, but an incorrectly formatted /etc/resolv.conf on the host;

What does /etc/resolv.conf on the host look like?

@AlekseyMartynov
Copy link
Author

@thaJeztah
The issue is about the new "Linux Containers on Windows" mode of Docker for Windows. The host is Windows machine, so there's no /etc/resolv.conf on the host.

@friism
Copy link
Contributor

friism commented Dec 1, 2017

@AlekseyMartynov since this is LCOW-related, consider opening an issue here: https://github.com/Microsoft/opengcs/issues

@thaJeztah thaJeztah added the area/lcow Issues and PR's related to the experimental LCOW feature label Oct 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/lcow Issues and PR's related to the experimental LCOW feature area/networking status/more-info-needed
Projects
None yet
Development

No branches or pull requests

3 participants