{"action":"opened","issue":{"url":"https://api.github.com/repos/docker/docker/issues/15889","labels_url":"https://api.github.com/repos/docker/docker/issues/15889/labels{/name}","comments_url":"https://api.github.com/repos/docker/docker/issues/15889/comments","events_url":"https://api.github.com/repos/docker/docker/issues/15889/events","html_url":"https://github.com/docker/docker/issues/15889","id":103538701,"number":15889,"title":"getaddrinfo in Windows docker container","user":{"login":"StefanScherer","id":207759,"avatar_url":"https://avatars.githubusercontent.com/u/207759?v=3","gravatar_id":"","url":"https://api.github.com/users/StefanScherer","html_url":"https://github.com/StefanScherer","followers_url":"https://api.github.com/users/StefanScherer/followers","following_url":"https://api.github.com/users/StefanScherer/following{/other_user}","gists_url":"https://api.github.com/users/StefanScherer/gists{/gist_id}","starred_url":"https://api.github.com/users/StefanScherer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/StefanScherer/subscriptions","organizations_url":"https://api.github.com/users/StefanScherer/orgs","repos_url":"https://api.github.com/users/StefanScherer/repos","events_url":"https://api.github.com/users/StefanScherer/events{/privacy}","received_events_url":"https://api.github.com/users/StefanScherer/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-08-27T15:44:33Z","updated_at":"2015-08-27T15:44:33Z","closed_at":null,"body":"Description of problem:\r\nRunning `npm install` fails inside a Windows Docker container with **Error: getaddrinfo ENOENT registry.npmjs.org:443**. Reducing the problem to the core it seems that `getaddrinfo` does not handle `AI_ADDRCONFIG` correctly.\r\n\r\n`docker version`:\r\n```\r\nClient:\r\n Version:      1.9.0-dev\r\n API version:  1.21\r\n Go version:   go1.4.2\r\n Git commit:   4376380\r\n Built:        Wed Aug 19 14:59:24 UTC 2015\r\n OS/Arch:      windows/amd64\r\n\r\nServer:\r\n Version:      1.9.0-dev\r\n API version:  1.21\r\n Go version:   go1.4.2\r\n Git commit:   4376380\r\n Built:        Wed Aug 19 14:59:24 UTC 2015\r\n OS/Arch:      windows/amd64\r\n```\r\n\r\n`docker info`:\r\n```\r\nContainers: 37\r\nImages: 89\r\nStorage Driver: windowsfilter\r\n Windows:\r\nExecution Driver: Windows 1854 1.9.0-dev 4376380\r\nLogging Driver: json-file\r\nKernel Version: 10.0 10514 (10514.0.amd64fre.th2_release.150808-1529)\r\nOperating System: Windows Server 2016 Technical Preview 3\r\nCPUs: 2\r\nTotal Memory: 4 GiB\r\nName: VAGRANT-2016\r\nID: 3A6C:S32I:LEC6:YQJB:7PIZ:OK6F:5DEX:X4EI:4SQV:U6MJ:FOTF:W2KN\r\nDebug mode (server): true\r\nFile Descriptors: -1\r\nGoroutines: 14\r\nSystem Time: 2015-08-22T12:59:06.9061205-07:00\r\nEventsListeners: 0\r\nInit SHA1:\r\nInit Path: C:\\Windows\\System32\\docker.exe\r\nDocker Root Dir: C:\\ProgramData\\docker\r\n```\r\n\r\n`uname -a`:\r\n```\r\nMSYS_NT-10.0 vagrant-2016 2.1.0(0.288/5/3) 2015-06-28 18:57 x86_64 Msys\r\n```\r\n\r\nEnvironment details (AWS, VirtualBox, physical, etc.):\r\nWindows 2016 TP3 running in VMware Fusion 7.1.2 on a Mac OSX 10.10.4\r\n\r\nHow reproducible:\r\n\r\n\r\nSteps to Reproduce:\r\n1. After a long investigation in nodejs/node#2578 I've built a static windows binary to do some test with the `getaddrinfo` function.\r\n2. Create a docker container image with that binary\r\n\r\nDockerfile:\r\n```\r\nFROM windowsservercore\r\n\r\nRUN powershell -Command \"wget -Uri https://github.com/StefanScherer/win-getaddrinfo/releases/download/1.0.5/getaddrinfo.exe -OutFile getaddrinfo.exe -UseBasicParsing\"\r\n\r\nCMD [ \"getaddrinfo\" ]\r\n```\r\n\r\nRun\r\n\r\n```\r\ndocker build -t getaddrinfo .\r\n```\r\n\r\n3. Run a container and run the test binary without and with the AI_ADDRCONFIG flag\r\n\r\n```\r\ndocker run -it getaddrinfo cmd\r\nC:\\Windows\\system32>getaddrinfo registry.npmjs.org 80 0\r\nC:\\Windows\\system32>getaddrinfo registry.npmjs.org 80 AI_ADDRCONFIG\r\n```\r\n\r\nActual Results:\r\nOnly without the AI_ADDRCONFIG flag the DNS lookup works.\r\n\r\n```\r\nC:\\Windows\\system32>getaddrinfo.exe registry.npmjs.org 0 0\r\nCalling getaddrinfo with following parameters:\r\n        nodename = registry.npmjs.org\r\n        servname (or port) = 0\r\n        hints.ai_flags = 0x0\r\n\r\ngetaddrinfo returned success\r\ngetaddrinfo response 1\r\n        Flags: 0x0\r\n        Family: AF_INET (IPv4)\r\n        IPv4 address 185.31.17.162\r\n        Socket type: SOCK_STREAM (stream)\r\n        Protocol: IPPROTO_TCP (TCP)\r\n        Length of this sockaddr: 16\r\n        Canonical name: (null)\r\n\r\nC:\\Windows\\system32>getaddrinfo.exe registry.npmjs.org 0 AI_ADDRCONFIG\r\nCalling getaddrinfo with following parameters:\r\n        nodename = registry.npmjs.org\r\n        servname (or port) = 0\r\n        hints.ai_flags = 0x400\r\n\r\ngetaddrinfo failed with error: 11004\r\n\r\nC:\\Windows\\system32>ipconfig /all\r\n\r\nWindows IP Configuration\r\n\r\n   Host Name . . . . . . . . . . . . : vagrant-2016\r\n   Primary Dns Suffix  . . . . . . . :\r\n   Node Type . . . . . . . . . . . . : Hybrid\r\n   IP Routing Enabled. . . . . . . . : No\r\n   WINS Proxy Enabled. . . . . . . . : No\r\n   DNS Suffix Search List. . . . . . : localdomain\r\n\r\nEthernet adapter vEthernet (Virtual Switch-efde3b0e095f5d721e3324ea41803b460e9cb3fc0e37a644c12647da9e7da541-0):\r\n\r\n   Connection-specific DNS Suffix  . : localdomain\r\n   Description . . . . . . . . . . . : Hyper-V Virtual Ethernet Adapter #3\r\n   Physical Address. . . . . . . . . : 00-15-5D-00-00-01\r\n   DHCP Enabled. . . . . . . . . . . : Yes\r\n   Autoconfiguration Enabled . . . . : Yes\r\n   Link-local IPv6 Address . . . . . : fe80::a09f:38f0:1c94:bc6%20(Preferred)\r\n   IPv4 Address. . . . . . . . . . . : 172.16.0.2(Preferred)\r\n   Subnet Mask . . . . . . . . . . . : 255.240.0.0\r\n   Default Gateway . . . . . . . . . : 172.16.0.1\r\n   DNS Servers . . . . . . . . . . . : 192.168.254.2\r\n   NetBIOS over Tcpip. . . . . . . . : Disabled\r\n```\r\n\r\nExpected Results:\r\nThe getaddrinfo should lookup the IP address in both cases as the Docker container has an IPv4 address 172.16.0.2. See [MSDN getaddrinfo AI_ADDRCONFIG](https://msdn.microsoft.com/en-us/library/windows/desktop/ms738520(v=vs.85).aspx#AI_ADDRCONFIG) for details.\r\n\r\nAdditional info:\r\n\r\n\r\nThe source to the static binary can be found in this public repo: https://github.com/StefanScherer/win-getaddrinfo\r\nThis is a slightly modified version of the code example from the MSDN getaddrinfo description.\r\n\r\n/cc @swernli @jhowardmsft "}}