{"action":"created","issue":{"url":"https://api.github.com/repos/docker/docker/issues/18868","repository_url":"https://api.github.com/repos/docker/docker","labels_url":"https://api.github.com/repos/docker/docker/issues/18868/labels{/name}","comments_url":"https://api.github.com/repos/docker/docker/issues/18868/comments","events_url":"https://api.github.com/repos/docker/docker/issues/18868/events","html_url":"https://github.com/docker/docker/issues/18868","id":123610828,"number":18868,"title":"DNS does not work in --restart always containers after system reboot","user":{"login":"scf37","id":1148465,"avatar_url":"https://avatars.githubusercontent.com/u/1148465?v=3","gravatar_id":"","url":"https://api.github.com/users/scf37","html_url":"https://github.com/scf37","followers_url":"https://api.github.com/users/scf37/followers","following_url":"https://api.github.com/users/scf37/following{/other_user}","gists_url":"https://api.github.com/users/scf37/gists{/gist_id}","starred_url":"https://api.github.com/users/scf37/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scf37/subscriptions","organizations_url":"https://api.github.com/users/scf37/orgs","repos_url":"https://api.github.com/users/scf37/repos","events_url":"https://api.github.com/users/scf37/events{/privacy}","received_events_url":"https://api.github.com/users/scf37/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/docker/docker/labels/area/networking","name":"area/networking","color":"fbca04"},{"url":"https://api.github.com/repos/docker/docker/labels/kind/bug","name":"kind/bug","color":"FF8C94"},{"url":"https://api.github.com/repos/docker/docker/labels/version/1.9","name":"version/1.9","color":"ededed"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2015-12-23T06:55:59Z","updated_at":"2016-10-11T23:58:05Z","closed_at":null,"body":"Description of problem:\r\n\r\nOften after reboot DNS in containers does not work.\r\n\r\n```\r\nroot@host:/opt/rabbit# ping google.com\r\nping: unknown host google.com\r\n```\r\n\r\nPossibly because resolf.conf in there is empty:\r\n\r\n```\r\nscf37@host:~$ docker exec -it rabbitmq bash\r\nroot@host:/opt/rabbit# cat /etc/resolv.conf \r\n# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)\r\n#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN\r\nroot@host:/opt/rabbit#`\r\n```\r\nAfter container restart, `nameserver 127.0.1.1` is added to resolv.conf and DNS starts working\r\n\r\nDNS in new containers works OK as well\r\n\r\nWe use `ubuntu:14.04` as a base and following line to create containers:\r\n`docker run -d --name rabbitmq --restart always -it --net=host myrepo.com/rabbitmq:7`\r\n\r\n`docker version`:\r\nClient:\r\n Version:      1.9.1\r\n API version:  1.21\r\n Go version:   go1.4.2\r\n Git commit:   a34a1d5\r\n Built:        Fri Nov 20 13:20:08 UTC 2015\r\n OS/Arch:      linux/amd64\r\n\r\nServer:\r\n Version:      1.9.1\r\n API version:  1.21\r\n Go version:   go1.4.2\r\n Git commit:   a34a1d5\r\n Built:        Fri Nov 20 13:20:08 UTC 2015\r\n OS/Arch:      linux/amd64\r\n\r\n`docker info`:\r\nContainers: 51\r\nImages: 470\r\nServer Version: 1.9.1\r\nStorage Driver: aufs\r\n Root Dir: /var/lib/docker/aufs\r\n Backing Filesystem: extfs\r\n Dirs: 572\r\n Dirperm1 Supported: true\r\nExecution Driver: native-0.2\r\nLogging Driver: json-file\r\nKernel Version: 4.2.0-18-generic\r\nOperating System: Ubuntu 15.10\r\nCPUs: 4\r\nTotal Memory: 31.38 GiB\r\nName: host\r\nID: 5NTF:VA5P:TSJP:NAWI:T4XD:P4LP:TDRL:EGD6:VPOV:PSCO:6EN7:RRQJ\r\nUsername: scf37\r\nRegistry: https://index.docker.io/v1/\r\nWARNING: No swap limit support\r\n\r\n\r\n`uname -a`:\r\nLinux host 4.2.0-18-generic #22-Ubuntu SMP Fri Nov 6 18:25:50 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux\r\n\r\nEnvironment details (AWS, VirtualBox, physical, etc.):\r\nphysical Intel Core i6\r\n\r\nHow reproducible:\r\nHappens sometimes both on local machine and on AWS boxes\r\n\r\nSteps to Reproduce:\r\n1. See above\r\n2. Reboot\r\n3. Sometimes DNS in containers will not work\r\n\r\n\r\nActual Results:\r\nNot working DNS\r\n\r\nExpected Results:\r\nWorking DNS\r\n\r\nAdditional info:\r\n"},"comment":{"url":"https://api.github.com/repos/docker/docker/issues/comments/253081413","html_url":"https://github.com/docker/docker/issues/18868#issuecomment-253081413","issue_url":"https://api.github.com/repos/docker/docker/issues/18868","id":253081413,"user":{"login":"kralos","id":1563856,"avatar_url":"https://avatars.githubusercontent.com/u/1563856?v=3","gravatar_id":"","url":"https://api.github.com/users/kralos","html_url":"https://github.com/kralos","followers_url":"https://api.github.com/users/kralos/followers","following_url":"https://api.github.com/users/kralos/following{/other_user}","gists_url":"https://api.github.com/users/kralos/gists{/gist_id}","starred_url":"https://api.github.com/users/kralos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kralos/subscriptions","organizations_url":"https://api.github.com/users/kralos/orgs","repos_url":"https://api.github.com/users/kralos/repos","events_url":"https://api.github.com/users/kralos/events{/privacy}","received_events_url":"https://api.github.com/users/kralos/received_events","type":"User","site_admin":false},"created_at":"2016-10-11T23:58:05Z","updated_at":"2016-10-11T23:58:05Z","body":"I can confirm this is still happening on Docker version 1.12.1, build 23cf638 on Ubuntu 16.04 desktop (a dev machine).\r\n\r\nWith regards to the ordering, Ubuntu Desktop uses NetworkManager which in turn uses dnsmasq and updates `host:/etc/resolv.conf` with `nameserver 127.0.1.1`. This happens after docker has copied `host:/etc/resolv.conf` to `host:/var/lib/docker/containers/<blah>/resolv.conf`\r\n\r\n@thaJeztah You are correct, this is a race condition specific to hosts running NetworkManager (Ubuntu Desktop).\r\n\r\nThis race condition can be solved on Ubuntu Desktop by instructing the docker.service to start after `NetworkManager-wait-online.service`\r\n\r\n`/lib/systemd/system/docker.service`\r\n```\r\n[Unit]\r\nAfter=network.target NetworkManager-wait-online.service docker.socket\r\n```\r\n\r\nI think this is an issue for the `docker-engine` ubuntu package."}}
{"actor":{"display_login":"kralos"}}