Access host (not vm) from inside container

I think you should be able to access the external IP of the Mac from a container with no issues, eg:

whale:docker justin$ ifconfig en0
en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
	ether ac:bc:32:cc:d0:89 
	inet6 fe80::aebc:32ff:fecc:d089%en0 prefixlen 64 scopeid 0x4 
	inet 172.16.10.16 netmask 0xffff0000 broadcast 172.16.255.255
	nd6 options=1<PERFORMNUD>
	media: autoselect
	status: active
whale:docker justin$ docker run alpine ping 172.16.10.16
PING 172.16.10.16 (172.16.10.16): 56 data bytes
64 bytes from 172.16.10.16: seq=0 ttl=37 time=0.221 ms
64 bytes from 172.16.10.16: seq=1 ttl=37 time=0.452 ms
^C
--- 172.16.10.16 ping statistics ---
2 packets transmitted, 2 packets received, 0% packet loss
round-trip min/avg/max = 0.221/0.336/0.452 ms

There is no standard name for this, and it will not work if you have no network access unfortunately, as your mac will not have an IP.

2 Likes