Unable to Resolve Public Hostname from within Container

Description

Unable to resolve public hostnames from a docker container

  • login.microsoftonline.com
  • azure.com
  • aws.com
$ ping azure.com
PING azure.com (40.74.133.20) 56(84) bytes of data.
^C
--- azure.com ping statistics ---
5 packets transmitted, 0 received, 100% packet loss, time 4178ms

Steps to reproduce the issue:

  1. Create a container
  2. Ping any of the above hosts

Describe the results you received:

Ping times out

Describe the results you expected:

Ping works

Additional information you deem important (e.g. issue happens only occasionally):

Output of docker version:

Docker version 18.09.2, build 6247962

Output of docker info:

Containers: 155
 Running: 1
 Paused: 0
 Stopped: 154
Images: 1769
Server Version: 18.09.2
Storage Driver: overlay2
 Backing Filesystem: extfs
 Supports d_type: true
 Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: bridge host macvlan null overlay
 Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 9754871865f7fe2f4e74d43e2fc7ccd237edcbce
runc version: 09c8266bf2fcf9519a651b04ae54c967b9ab86ec
init version: fec3683
Security Options:
 seccomp
  Profile: default
Kernel Version: 4.9.125-linuxkit
Operating System: Docker for Mac
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 1.952GiB
Name: linuxkit-025000000001
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): true
 File Descriptors: 35
 Goroutines: 67
 System Time: 2019-03-09T04:07:34.115212518Z
 EventsListeners: 2
HTTP Proxy: gateway.docker.internal:3128
HTTPS Proxy: gateway.docker.internal:3129
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
 172.30.0.0/16
 127.0.0.0/8
Live Restore Enabled: false
Product License: Community Engine