The most prevalent solution for running docker on the mac is using boot2docker or maybe a CoreOS vagrant VM. In either case the docker0 network is not accessible in the mac since the it is created as a host only network on Virtual Box, usually with the CIDR of 172.17.0.0/16

A simple way to get connectivity to the host only network created for docker is to add a route for the docker's network CIDR with the gateway of the VM's IP

  1. Find the IP of your VM, if you are using docker machine then: $: docker-machine ls
  2. Find the CIDR for you docker private network
    • $: docker-machine ssh yourVmName
    • $: ifconfig docker0 | grep "inet addr" if the netmask is 255.255.0.0 that means it is a /16 network so if the gateway is 172.17.42.1 its CIDR would be 172.17.0.0/16
  3. Create a route for docker0 network: $: sudo route -n add 172.17.0.0/16 192.168.99.100

To confirm that the route was added successfuly you can check the route table entries with netstat, you should see something like this:

netstat -nr  
172.17             192.168.99.100     UGSc            1        4 vboxnet