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

resolv.conf no such file o directory #4861

Closed
danisilver opened this issue Mar 26, 2014 · 17 comments
Closed

resolv.conf no such file o directory #4861

danisilver opened this issue Mar 26, 2014 · 17 comments
Assignees
Labels
area/networking kind/bug Bugs are bugs. The cause may or may not be known at triage time so debugging may be needed.

Comments

@danisilver
Copy link

i just left to install docker on ubuntu 12.04 from this guide :
http://docs.docker.io/en/latest/installation/ubuntulinux/
and i got this

➜ ~ sudo docker run -i -t ubuntu /bin/bash
2014/03/26 11:45:17 Error: open /etc/resolv.conf: no such file or directory

any suggestions?

@lafolle
Copy link

lafolle commented Mar 29, 2014

Problem with your host machine. Create /etc/resolv.conf and populate it with appropriate DNS information and try the command again.

@unclejack
Copy link
Contributor

This isn't a Docker bug, it's a problem caused by the absence of /etc/resolv.conf on your host. I can reproduce the problem when there's no resolv.conf on the host.

Please fix your Linux system.

@ghost
Copy link

ghost commented Apr 14, 2014

IMHO the file is not necessary, is it? So, it shouldn't be about a broken OS.
http://man7.org/linux/man-pages/man5/resolv.conf.5.html

@lafolle
Copy link

lafolle commented Apr 14, 2014

If this file does not exist, only the name server on the local machine will be queried;

In that case DNS server should be running on your local machine.

@OOPMan
Copy link

OOPMan commented Jul 6, 2014

I experience this issue and it seems to be a side-effect of the NetworkManager config on my distribution, Sabayon Linux.

In my case, /etc/resolv.conf is a symlink to /etc/resolvconf/run/resolve.conf and is only created after NetworkManager connects to a network. This makes Docker fail to start on boot but it starts fine after I've logged in and connect to a network.

@crosbymichael
Copy link
Contributor

@OOPMan In your init script shouldn't you depend on NetworkManager being up before the docker service is started?

@tianon
Copy link
Member

tianon commented Jul 7, 2014

I also wonder if this should be an upstream Go (specifically "netgo") issue - do we actually check for resolv.conf directly, or only indirectly via the netgo implementation?

@OOPMan
Copy link

OOPMan commented Jul 7, 2014

I've realised that my problem has nothing to do with NM or Sabayon Linux :-)

I am running on an Asus X550CC. Overall, a decent machine but it has one caveat: The Wi-Fi hardware is disabled under Linux until you sleep and then resume. This means that on boot, unconnected to a wired LAN, the system basically decides there is no working network and hence /etc/resolv.conf doesn't contain anything. Docker doesn't like this and hence fails to start.

Once I've suspend-resumed then everything is fine and Docker starts.

benlei added a commit to benlei/shared that referenced this issue Sep 26, 2016
The solution on the official docker site doesn't work; it complains that the /etc/resolv.conf is missing (ref: moby/moby#4861)
@duffsterlp
Copy link

@unclejack @crosbymichael I am still seeing this issue today on docker version 1.12.6.
Why does /etc/resolv.conf gate running docker containers?

@runcom
Copy link
Member

runcom commented May 5, 2017

I think there hasn't been a good answer on this and since I'm also experiencing this I'm reopening. @thaJeztah could you ping network maintainers? At this point I don't understand why container start is gated by network (we do have isolated machines where there's no resolv.conf file but we want to start containers anyway)

@runcom runcom reopened this May 5, 2017
@stefwalter
Copy link

The resolv.conf manual (from glibc) states:

   If this file does not exist, only the name server on the local
   machine will be queried; the domain name is determined from the
   hostname and the domain search path is constructed from the domain
   name.

Therefore it should be assumed that a Linux system without a resolv.conf is a valid Linux system.

Other software such as golang's DNS resolv.conf loading logic, deals with missing or inaccessible resolv.conf in the same way: https://golang.org/src/net/dnsconfig_unix.go

@martinpitt
Copy link

Also, resolv.conf is not necessary on systems which use non-libc NSS modules such as nss-resolve or winbind, ldap, etc.

@thaJeztah thaJeztah added area/networking kind/bug Bugs are bugs. The cause may or may not be known at triage time so debugging may be needed. labels May 8, 2017
@thaJeztah
Copy link
Member

/cc @sanimej

@saimonn
Copy link

saimonn commented Jul 7, 2017

This bug also prevent from using docker offline on some distributions.

@hqhq
Copy link
Contributor

hqhq commented Jul 24, 2017

Trying to fix it in: moby/libnetwork#1847

@HeGuanyuan
Copy link

just create an empty file names 'resolv.conf' at the place, my problem solved~

@thaJeztah
Copy link
Member

I see the fix for this was merged through 1ddeb11, which will be included in the upcoming 17.10 release; https://github.com/docker/docker-ce/blob/17.10/components/engine/vendor/github.com/docker/libnetwork/sandbox_dns_unix.go

closing, because this is resolved on master 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/networking kind/bug Bugs are bugs. The cause may or may not be known at triage time so debugging may be needed.
Projects
None yet
Development

No branches or pull requests