Open bobwilkinson20 opened 3 years ago
I had almost the exact same issue on Docker for Mac. I could ping api.github.com and github.com fine on my host, but when ran in the container, it returned ping: bad address 'github.com'
nslookup
's error was ** server can't find github.com: NXDOMAIN
I was previously on Docker 2.5.0.1, and updating to the latest Docker for Mac resolved the issue
same issue as @paullegrand
Seems like an issue in combination with Docker Desktop for mac and the alpine version. After updating docker desktop, I could ping github.com again.
I observe the same issue, but not on Mac. I'm on Synology's NAS, DS 920+, which is a highly customized Linux distro.
Output of docker version
:
Client:
Version: 20.10.3
API version: 1.41
Go version: go1.15.6
Git commit: b455053
Built: Mon Jun 21 02:03:40 2021
OS/Arch: linux/amd64
Context: default
Experimental: true
Server:
Engine:
Version: 20.10.3
API version: 1.41 (minimum version 1.12)
Go version: go1.15.6
Git commit: a3bc36f
Built: Mon Jun 21 02:05:07 2021
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: v1.4.3
GitCommit: ea3508454ff2268c32720eb4d2fc9816d6f75f88
runc:
Version: v1.0.0-rc93
GitCommit: 31cc25f16f5eba4d0f53e35374532873744f4b31
docker-init:
Version: 0.19.0
GitCommit: **ed96d00**
Expected behavior
github.com should be reachable for use via git, ping, etc.
Actual behavior
github.com resolves successfully in dig and nslookup (although it appears there may be 2 responses - one non-authoritative and successful, and another that returns NXDOMAIN), but ping reports 'bad address' and git reports 'Could not resolve host'. Note that the issue is seemingly only occurring for github.com - I tried numerous other public domains (google.com, yahoo.com, etc.) and none showed the issue. There is no configuration specific to github.com in /etc/hosts on either container or host (see those and other details below).
The only workaround for the underlying resolver issue I have found after much trial and error is replacing the default docker resolver (127.0.0.11) in the container
/etc/resolv.conf
with an external resolver such as8.8.8.8
but that has other obvious consequences. Adding github.com to /etc/hosts on the container also works around the issue.Note that this flux issue appears quite similar in the observed behavior. One of the resolution comments mentions something about CloudFlare but it's hard to see that would relate here.
Steps to reproduce the behavior
Output of
docker version
:Output of
docker info
:Additional environment details (AWS, VirtualBox, physical, etc.) Container: Alpine Linux v3.13 Host: MacOS 10.15.7
container
/etc/resolv.conf
:container
/etc/hosts
:container
/etc/nsswitch.conf
:host
/etc/resolv.conf
:Output of
ping github.com
from container:Output of
nslookup github.com
from container:Output of
dig github.com
from container: