Can not ping docker in macOS

I have docker installed on my local but I can not ping it in Mac but I can ping on Ubuntu for same thing.

$ docker inspect -f '{{ .NetworkSettings.IPAddress }}' n1

$ ping
PING ( 56 data bytes
Request timeout for icmp_seq 0
Request timeout for icmp_seq 1
Request timeout for icmp_seq 2
Request timeout for icmp_seq 3
Request timeout for icmp_seq 4
Request timeout for icmp_seq 5
--- ping statistics ---
7 packets transmitted, 0 packets received, 100.0% packet loss

I installed docker on mac following

  • Firefox Proxy to Docker Fiddler refusing connection
  • Docker service does not start
  • All images and containers disappeared after host kernel downgrade
  • How to POST InputStream as the body of a request in Retrofit?
  • docker centos:6.6 image “/bin/sh: java: command not found” java is installed
  • How to rename a Bluemix namespace (container registry)?
  • What is the proper way to “combine” Docker images?
  • Can I have one Docker Swarm Manager and different clusters?
  • IPC communication between Docker containers
  • Use consul to export IP and Port to another Docker container dynamically
  • Docker publishing ports to multiple IPs
  • Running ubuntu containers on ubuntu host - application with gui
  • 2 Solutions collect form web for “Can not ping docker in macOS”

    It is not just ping. As commented in issue 155

    xhyve vm inside Docker for Mac hasn’t no Network Adapter. Or routable IP like boot2docker ( like that)

    With boot2docker and a route command its possible to Route all the Container ips to the vm Network.

    We need this for xhyve.

    (there are a lot of threads on this topic in Docker for Mac forum)

    That’s normal.

    Take a look at your Mac’s interface config – there is no 172.x.x.x network on the Mac itself. Those live in the xhyve Linux VM that is actually hosting Docker.

    Network connections are mapped through when you use port maps (e.g. docker run -p ...) but ping will not work like this.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.