Skip to content
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

They're close, but "docker.for.mac.host.*" and "docker.for.win.*" should be better #2705

Closed
atrauzzi opened this issue Mar 19, 2018 · 11 comments

Comments

@atrauzzi
Copy link

When running Docker for Windows and Docker for macOS, we get these handy aliases like docker.for.mac.localhost, docker.for.mac.internal, docker.for.win.localhost and docker.for.win.internal.

Unfortunately, when my projects are being worked on between macOS and Windows, someone has to go changing any of these host names for the specific platform they're on, despite the premise of the two being the same! The fact that these two things that accomplish the exact same outcome are named differently is unhelpful.

Is there any way we can get a new convention like docker.internal and docker.localhost? Would it also be possible to simply have them resolve localhost when used on Linux which obviously doesn't have the extra layer going on?

The name of the game here is that I need my containers to have a consistent way to reference not the VM, but the actual physical hardware they're running on. Bonus points if it's a consistent IP address so that I can configure my own DNS aliases!

Moreover, would it be possible either with or without my suggested change to get all these magic hostnames documented somewhere? They seem to be rather un-googleable and largely defined by anecdotal knowledge rather than being clearly offered.

cc.

@akimd
Copy link
Contributor

akimd commented Mar 19, 2018

In recent releases (18.03.0-ce-rc1-mac54 for instance), we provide host.docker.internal. We were clearly wrong to use mac/win in the first place.

About the documentation part, you are right. we will do this. Currently this is "documented" in the ChangeLogs :)

@akimd akimd self-assigned this Mar 19, 2018
akimd added a commit to akimd/docker.github.io that referenced this issue Mar 19, 2018
Prompted by docker/for-mac#2705 (and
docker/for-win#1855).

Signed-off-by: Akim Demaille <akim.demaille@docker.com>
@atrauzzi
Copy link
Author

Oh jeez, so I'm just late to the party then?!? 😉

#slowpokealex

akimd added a commit to akimd/docker.github.io that referenced this issue Mar 21, 2018
Prompted by docker/for-mac#2705 (and
docker/for-win#1855).

Signed-off-by: Akim Demaille <akim.demaille@docker.com>
@akimd
Copy link
Contributor

akimd commented Mar 26, 2018

Done.

@akimd akimd closed this as completed Mar 26, 2018
@seb-h-k
Copy link

seb-h-k commented Mar 27, 2018

Great to see. This makes things a lot simpler for us. Does it work on linux too? Would be great if we could get rid of special cases in the development configuration and have a single dns for all environments (win, mac, linux).

@atrauzzi
Copy link
Author

Yeah, the linux case is especially important.

@tenoriojuann
Copy link

Seeing an issue after upgrading, neither host.docker.internal or gateway.docker.internal resolve when making a request within the containers to a service running on the host machine. Also the old docker.for.mac.host.internal does not work.

I am running Version 18.03.0-ce-mac60 (23751)

@Dominik-K
Copy link

Dominik-K commented Apr 5, 2018

@tenoriojuann Can't confirm your bug (exact same version). What does

docker run --rm alpine nslookup host.docker.internal

return?

@tenoriojuann
Copy link

tenoriojuann commented Apr 16, 2018

@Dominik-K

The given command returns:

nslookup: can't resolve '(null)': Name does not resolve

Name:      host.docker.internal
Address 1: 192.168.65.2

My mac's IP address starts with 135.198.X.X so that 192.X.X.X is completely off

edit: I did a docker system prune --volumes and everything seems to be working now.

@atrauzzi
Copy link
Author

atrauzzi commented Apr 19, 2018

@akimd - Any chance we can ensure this works on linux hosts as well? Just ran on ubuntu:

Unable to find image 'alpine:latest' locally
latest: Pulling from library/alpine
ff3a5c916c92: Pull complete 
Digest: sha256:7df6db5aa61ae9480f52f0b3a06a140ab98d427f86d8d5de0bedab9b8df6b1c0
Status: Downloaded newer image for alpine:latest

nslookup: can't resolve '(null)': Name does not resolve
nslookup: can't resolve 'host.docker.internal': Name does not resolve
Docker version 18.05.0-ce-dev, build d87b0c1

@atrauzzi
Copy link
Author

atrauzzi commented Jun 14, 2018

Pinging again as this is really getting a bit stale and probably should be addressed soon to unblock this whole situation. This needs to be docker-universal.

@akimd - Any chance you can poke someone from your side of the fence over at for-linux? 😉

cc. docker/for-linux#264

@docker-robott
Copy link
Collaborator

Closed issues are locked after 30 days of inactivity.
This helps our team focus on active issues.

If you have found a problem that seems similar to this, please open a new issue.

Send feedback to Docker Community Slack channels #docker-for-mac or #docker-for-windows.
/lifecycle locked

@docker docker locked and limited conversation to collaborators Jun 28, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants