Docker Community Forums

Share and learn in the Docker community.

How to connect from container to host machine


(Ivan Shumkov) #1

How can i connect from container to host machine? Before i used 172.17.0.1 from container and it works. I tried to use 172.19.0.1 and it didn’t work. Also i don’t see docker0 interface on host machine.

Information

OS X: version 10.11.4 (build: 15E65)
Docker.app: version v1.11.1-beta12
Running diagnostic tests:
[OK] Moby booted
[OK] driver.amd64-linux
[OK] vmnetd
[OK] osxfs
[OK] db
[OK] slirp
[OK] menubar
[OK] environment
[OK] Docker
[OK] VT-x
Docker logs are being collected into /tmp/20160519-120819.tar.gz
Most specific failure is: No error was detected
Your unique id is: F584B968-72A7-4EE2-95B3-5E18C976EEDF
Please quote this in all correspondence.


(Craig Warren) #2

I would really like an answer to this too.

In the days of docker-machine we used 10.0.2.2 to refer to the host (mac) but this no longer seems to work.

How can my containers refer to the host mac?


(Justin) #3

Previously, I was forwarding my X Display down to the containers on OSX like jfrazelle was doing.

However, with 1.12, it seems the Host machine is not directly available to the Docker containers as my bridge0 device does not default have an IP.

Currently, I’m allowing 172.17.0.2 access via xhost, and setting the container’s DISPLAY variable to my outward-facing (not my inward-to-docker-facing) IP address.

I would rather only have my xhost listening on bridge0, not eth0.

REF: https://github.com/docker/docker/issues/8710