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

WSL: Add host.docker.internal and host.minikube.internal to containers. #1258

Closed
wants to merge 4 commits into from

Conversation

mook-as
Copy link
Contributor

@mook-as mook-as commented Jan 18, 2022

This partially fixes #893. This forces dockerd to write out /etc/hosts in the containers for host.docker.internal and host.minikube.internal, so that they can contact the host (tested by attempting to make an ssh connection and verifying the host key).

Note that this will not help with things from the host side (from within Windows, or a different WSL distribution); doing so will require administrative privileges to update /etc/hosts as seem from Windows.

This stops copying the wsl.conf over from the main WSL distribution, so
that we can provide different contents in the main one.

Signed-off-by: Mark Yen <mark.yen@suse.com>
This edits /etc/hosts on the main distribution to add entries for
host.docker.internal and host.minikube.internal for compatibility.  We copy
over the /etc/hosts file in the data distribution (which we still ask WSL
to generate), and then add lines we need.

Note that this doesn't appear to actually affect any containers, as moby
uses an internal file to generate /etc/hosts.

Signed-off-by: Mark Yen <mark.yen@suse.com>
This forces an --add-host to all created containers to be able to resolve
host.docker.internal and host.minikube.internal for compatiblity reasons.

Signed-off-by: Mark Yen <mark.yen@suse.com>
Same as the previous commit, but for the Linux proxy.

Signed-off-by: Mark Yen <mark.yen@suse.com>
@mook-as mook-as requested a review from mattfarina January 18, 2022 02:20
@mook-as
Copy link
Contributor Author

mook-as commented Jan 18, 2022

Please leave the issue open on merge — still need to handle the containerd backend.

@mook-as
Copy link
Contributor Author

mook-as commented Jan 20, 2022

Closing for now — I believe we need to actually spin up a DNS forwarder on the VM to do what we want here. Some of the work will be used, but it shouldn't be merged as-is.

@mook-as mook-as closed this Jan 20, 2022
@mook-as mook-as deleted the wsl-etc-hosts-manual branch January 21, 2022 01:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

WSL: make host.docker.internal work
1 participant