New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker for Mac and docker network access from host #171

Closed
stefanfoulis opened this Issue Aug 8, 2016 · 10 comments

Comments

Projects
None yet
@stefanfoulis

stefanfoulis commented Aug 8, 2016

Expected behavior

I can access all containers by ip address from my OSX host directly.

Actual behavior

I can't access containers by network unless I map ports to 127.0.0.1.

Information

Diagnostic ID: 13B73004-5CA7-40F3-B597-AA61D1FC6C37
Docker for Mac: 1.12.0 (Build 10871)
macOS: Version 10.11.6 (Build 15G31)
[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

Steps to reproduce the behavior

  1. docker run --name=httpd -d httpd
  2. docker inspect httpd extract IPAddress from the output (e.g 172.17.0.2)
  3. curl http://172.17.0.2/ - expected to get the apache page, but get a timeout

Notes

I understand that the reason for this not working, is that this is due to the documented fact that there is no docker0 interface available on osx (https://docs.docker.com/docker-for-mac/networking/#/there-is-no-docker0-bridge-on-osx).
For our workflow (allowing the host to access containers directly from the host, without port mapping) it is pretty crucial. So my main question is, if there are plans to support this or if it is an impossible to overcome technical hurdle.

@onigoetz

This comment has been minimized.

Show comment
Hide comment
@onigoetz

onigoetz Aug 11, 2016

I would also be interested of the status on this.

onigoetz commented Aug 11, 2016

I would also be interested of the status on this.

@dbpolito

This comment has been minimized.

Show comment
Hide comment
@dbpolito

dbpolito Aug 31, 2016

I would love to see this too.

dbpolito commented Aug 31, 2016

I would love to see this too.

@Multiply

This comment has been minimized.

Show comment
Hide comment
@charlesporter

This comment has been minimized.

Show comment
Hide comment
@charlesporter

charlesporter Sep 20, 2016

+1 for addressing this

charlesporter commented Sep 20, 2016

+1 for addressing this

@AlmirKadric

This comment has been minimized.

Show comment
Hide comment
@AlmirKadric

AlmirKadric Sep 25, 2016

+1 for this fix

AlmirKadric commented Sep 25, 2016

+1 for this fix

@rcarmich

This comment has been minimized.

Show comment
Hide comment
@rcarmich

rcarmich Oct 13, 2016

I believe this is the same issue I'm experiencing. If I start an nginx container that should proxy to some code running on my actual host, I can't do that anymore since upgrading from docker toolbox. I used to be able to proxy requests to 10.0.2.2 or whatever IP my host was given, but now the host has no IP (other than my DHCP given IP) for a reliable proxy destination. Very much a blocker for us, unless I'm missing something.

(Edit):

Per some looking around, moby/moby#22753 helped somewhat. I just added an alias on my host, and that seemingly has gotten me around the problem.
sudo ifconfig lo0 alias 10.200.10.1/24

rcarmich commented Oct 13, 2016

I believe this is the same issue I'm experiencing. If I start an nginx container that should proxy to some code running on my actual host, I can't do that anymore since upgrading from docker toolbox. I used to be able to proxy requests to 10.0.2.2 or whatever IP my host was given, but now the host has no IP (other than my DHCP given IP) for a reliable proxy destination. Very much a blocker for us, unless I'm missing something.

(Edit):

Per some looking around, moby/moby#22753 helped somewhat. I just added an alias on my host, and that seemingly has gotten me around the problem.
sudo ifconfig lo0 alias 10.200.10.1/24

@wojas

This comment has been minimized.

Show comment
Hide comment
@wojas

wojas Oct 31, 2016

As a workaround, I ended up using OpenVPN to access the Docker networks.

My setup can be found here (easy to use Compose file): wojas/docker-mac-network

wojas commented Oct 31, 2016

As a workaround, I ended up using OpenVPN to access the Docker networks.

My setup can be found here (easy to use Compose file): wojas/docker-mac-network

@belooussov

This comment has been minimized.

Show comment
Hide comment
@belooussov

belooussov commented Nov 9, 2016

+1

@ijc

This comment has been minimized.

Show comment
Hide comment
@ijc

ijc Nov 18, 2016

Contributor

Closing as dup of #155. Please subscribe there for further updates

Contributor

ijc commented Nov 18, 2016

Closing as dup of #155. Please subscribe there for further updates

@ijc ijc closed this Nov 18, 2016

@AlmirKadric

This comment has been minimized.

Show comment
Hide comment
@AlmirKadric

AlmirKadric Jul 19, 2017

I am pasting this for anyone who comes here and feels at a loss
There is a shim workaround for this issue in this project
https://github.com/AlmirKadric-Published/docker-tuntap-osx

More details can be found here:
https://forums.docker.com/t/support-tap-interface-for-direct-container-access-incl-multi-host/17835/21

AlmirKadric commented Jul 19, 2017

I am pasting this for anyone who comes here and feels at a loss
There is a shim workaround for this issue in this project
https://github.com/AlmirKadric-Published/docker-tuntap-osx

More details can be found here:
https://forums.docker.com/t/support-tap-interface-for-direct-container-access-incl-multi-host/17835/21

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment