Bug 1118234 - Docker doesn't update DNS IP when it's changed on system
Summary: Docker doesn't update DNS IP when it's changed on system
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: docker-io
Version: rawhide
Hardware: All
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Lokesh Mandvekar
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-07-10 09:11 UTC by Maxime Carron
Modified: 2015-01-27 03:26 UTC (History)
8 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2015-01-27 03:26:17 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Maxime Carron 2014-07-10 09:11:32 UTC
Description of problem:
When the DNS server is changed on the system, docker keep using the one used at its startup.

Version-Release number of selected component (if applicable):
EL 7.0
docker : 1.0.0-1

How reproducible:
Always.

Steps to Reproduce:
1. Start docker (systemctl start docker)
2. Do any operation which needs DNS resolution (docker pull fedora:latest)
=> System DNS is used
3. Change system DNS to 8.8.8.8 or any different DNS
4. Do some other operation which needs DNS resolution (docker pull fedora:rawhide)
5. You should see that first is still used

Actual results:
No DNS update

Expected results:
Docker should use the current system DNS

Additional info:
This is especially disturbing on a laptop, because a docker restart is needed everytime I change network (when first DNS is not reachable anymore, usually when DNS has a private IP)

Comment 1 Lokesh Mandvekar 2014-07-11 17:07:49 UTC
Hmm, don't have a fix yet, but it seems:

Case 1: change DNS from reachable to unreachable address, DNS settings take effect right away

Case 2: change DNS from unreachable to reachable address, the very first docker operation fails, but subsequent ones work without a restart.

Sample run follows (on a rawhide instance):

lsm5 @ nagato : /home/lsm5 $ docker pull fedora:latest
Pulling repository fedora
3f2fed40e4b0: Download complete 
511136ea3c5a: Download complete 
fd241224e9cf: Download complete 
lsm5 @ nagato : /home/lsm5 $ cat /etc/resolv.conf 
nameserver 8.8.8.8
nameserver 8.8.4.4
lsm5 @ nagato : /home/lsm5 $ sudo mv /etc/resolv.conf /etc/resolv.conf.safe
lsm5 @ nagato : /home/lsm5 $ sudo vim /etc/resolv.conf      
lsm5 @ nagato : /home/lsm5 $ cat /etc/resolv.conf
nameserver 1.1.1.1
lsm5 @ nagato : /home/lsm5 $ docker pull fedora:rawhide
Pulling repository fedora
2014/07/11 11:43:36 Get https://cdn-registry-1.docker.io/v1/repositories/library/fedora/tags: dial tcp: lookup cdn-registry-1.docker.io on 1.1.1.1:53: no answer from server
lsm5 @ nagato : /home/lsm5 $ sudo mv /etc/resolv.conf.safe /etc/resolv.conf
lsm5 @ nagato : /home/lsm5 $ cat /etc/resolv.conf 
nameserver 8.8.8.8
nameserver 8.8.4.4
lsm5 @ nagato : /home/lsm5 $ docker pull fedora:rawhide
Pulling repository fedora
2014/07/11 11:46:07 Get https://index.docker.io/v1/repositories/fedora/images: dial tcp: lookup index.docker.io on 1.1.1.1:53: no answer from server
lsm5 @ nagato : /home/lsm5 $ docker pull fedora:rawhide
Pulling repository fedora
64fd7993bcaf: Download complete 
64fd7993bcaf: Pulling image (rawhide) from fedora 
511136ea3c5a: Download complete 


---/var/log/messages---

Jul 11 11:40:14 nagato docker: [584bdf56] -job pull(fedora, latest) = OK (0)
Jul 11 11:42:45 nagato docker: 2014/07/11 11:42:45 POST /images/create?fromImage=fedora&tag=rawhide
Jul 11 11:42:45 nagato docker: [584bdf56] +job pull(fedora, rawhide)
Jul 11 11:43:36 nagato docker: [error] server.go:1185 Get https://cdn-registry-1.docker.io/v1/repositories/library/fedora/tags: dial tcp: lookup cdn-registry-1.docker.io on 1.1.1.1:53: no answer from server
Jul 11 11:43:36 nagato docker: Get https://cdn-registry-1.docker.io/v1/repositories/library/fedora/tags: dial tcp: lookup cdn-registry-1.docker.io on 1.1.1.1:53: no answer from server
Jul 11 11:43:36 nagato docker: [584bdf56] -job pull(fedora, rawhide) = ERR (1)
Jul 11 11:45:47 nagato docker: 2014/07/11 11:45:47 POST /images/create?fromImage=fedora&tag=rawhide
Jul 11 11:45:47 nagato docker: [584bdf56] +job pull(fedora, rawhide)
Jul 11 11:46:07 nagato docker: Get https://index.docker.io/v1/repositories/fedora/images: dial tcp: lookup index.docker.io on 1.1.1.1:53: no answer from server
Jul 11 11:46:07 nagato docker: [584bdf56] -job pull(fedora, rawhide) = ERR (1)
Jul 11 11:46:11 nagato docker: 2014/07/11 11:46:11 POST /images/create?fromImage=fedora&tag=rawhide
Jul 11 11:46:11 nagato docker: [584bdf56] +job pull(fedora, rawhide)
Jul 11 11:46:16 nagato kernel: [37692.370612] EXT4-fs (dm-2): mounted filesystem with ordered data mode. Opts: discard
Jul 11 11:46:16 nagato kernel: EXT4-fs (dm-2): mounted filesystem with ordered data mode. Opts: discard
Jul 11 11:47:07 nagato kernel: [37743.712593] EXT4-fs (dm-3): mounted filesystem with ordered data mode. Opts: discard
Jul 11 11:47:07 nagato kernel: EXT4-fs (dm-3): mounted filesystem with ordered data mode. Opts: discard
Jul 11 11:47:16 nagato docker: [584bdf56] -job pull(fedora, rawhide) = OK (0)

---/var/log/messages---

Btw, the epel7 branch has been removed as docker is available by default on RHEL7. Though not sure if docker 1.0.0 (and later) have made it into RHEL7 proper yet.

Changing bug Product and Version to Fedora and rawhide.

Comment 2 Daniel Walsh 2014-10-24 20:49:46 UTC
docker-1.3 should pick up the /etc/resolv.conf file on docker run time not at the time the daemon starts.

I think this fixes most of your problem.

Comment 3 Daniel Walsh 2014-11-20 19:33:51 UTC
Not likely to change the rest.

Fixed in docker-1.3.1


Note You need to log in before you can comment on or make changes to this bug.