Accessing Host (IP/Port) services from container

Since docker host doesn’t have the docker0 interface bridge on Docker for Mac.
How can i connect to mysql on host from container?
I have not sucess trying to get the host ip address from container.

For example, I have an apache container running like this:
docker run -d --privileged -p 80:80 -p 443:443 --name apache -v /Users/hury/workspace/projects:/var/www --dns= myapache


Docker for Mac: version: mac-v1.12.0.1
OS X: version 10.11.6 (build: 15G31)
logs: /tmp/3E69606D-2BE0-4E4D-AA07-D11C461E3AE3/20160818-100411.tar.gz
[OK] docker-cli
[OK] app
[OK] moby-syslog
[OK] disk
[OK] virtualization
[OK] system
[OK] menubar
[OK] osxfs
[OK] db
[OK] slirp
[OK] moby-console
[OK] logs
[OK] vmnetd
[OK] env
[OK] moby
[OK] driver.amd64-linux

  • host distribution and version OSX El Capitan 10.11.6
1 Like