Skip to content
This repository has been archived by the owner on Apr 29, 2024. It is now read-only.

IP addresses in config map are not correct on Docker for Mac #34

Closed
michaelpigg opened this issue Dec 19, 2016 · 6 comments
Closed

IP addresses in config map are not correct on Docker for Mac #34

michaelpigg opened this issue Dec 19, 2016 · 6 comments

Comments

@michaelpigg
Copy link

When running on Docker for Mac, the IP address reported for the machine in the config map is not correct. The plugin appears to be reporting the IP address within the machine rather than the external IP address.

@michaelpigg
Copy link
Author

I tried a build with the changes on feature/dockerForMacSupport and it seems to work.

@kurtkopchik
Copy link
Contributor

Hi @michaelpigg, I'm glad you already found the feature/dockerForMacSupport branch! We have some more testing to do on that branch but hope to integrate it into the master branch soon for an official release. Let us know if you find any problems with it.

@stela
Copy link

stela commented Feb 16, 2017

Please consider merging and releasing the dockerForMacSupport branch, the exported ip:port isn't very useful with docker for mac at the moment.

However, if somebody is using Alpine Linux via some boot2docker alternative or as a host OS, won't it mis-detect it as docker for mac, which would break the hostname for those users? I guess it's not that common though.

I don't know of the "proper" way to probe for docker for mac, so I'd suggest also adding a check for docker version --format '{{.Client.Os}}' == darwin, then you know that the client is running on OS X which should significantly increase the odds it's really docker for mac. Reference: https://docs.docker.com/engine/reference/commandline/version/

Also see discussions on fixing this issue in docker for mac itself, it's a known issue:
https://forums.docker.com/t/support-tap-interface-for-direct-container-access-incl-multi-host/17835/4
https://forums.docker.com/t/ip-routing-to-container/8424

@kurtkopchik
Copy link
Contributor

Hi @stela - Thanks for pinging me on this issue and providing some links with your research. I had looked into this a while back myself and came up with an approach that appears to work but didn't get around to implementing the actual change until today.

The approach I took was to additionally validate that the Server.KernelVersion ends in -moby.

See the following thread for a bit of discussion on this:
http://stackoverflow.com/questions/38223965/how-can-i-detect-if-docker-for-mac-is-installed

I have merged these changes into the master branch and published a new release:
addSbtPlugin("com.tapad" % "sbt-docker-compose" % "1.0.19")

Let me know if it works for you. Thanks again for the feedback and using the plug-in!

@stela
Copy link

stela commented Feb 22, 2017

Works perfectly on my Mac using the System.getProperty("containername:portnr") approach, thanks!

@kurtkopchik
Copy link
Contributor

Great I'm glad that it's working as expected!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants