-
Notifications
You must be signed in to change notification settings - Fork 38
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
connect: connection refused when running in WSL2 #113
Comments
I can reproduce this, it seems to not be able to contact the server running on the host in WSL via host.docker.internal. It seems like this might be related: docker/for-win#12673 I'll have to dig into this more sometime and see if there's a way around the issue. |
I suspect my issue may be related, but not on WSL. My case is running the dependabot client within a docker container. I'm able to run this directly on a linux box (debian), no Windows, no vm involved works as expected:
But when I effectively run the same command within a docker container, the proxy fails to reach the API:
I'm not sure what I might be doing wrong. I am passing |
Hmm yeah this might be related to the WSL issue. Just so we're on the same page, the current network setup is this: flowchart LR
proxy --> internet
proxy-- host.docker.internal -->api
subgraph host
api
subgraph internal
updater --> proxy
end
end
By mounting the host's Docker socket, we end up with this: flowchart LR
proxy --> internet
proxy-- host.docker.internal --> nothing
subgraph host
nothing
subgraph internal1
api
subgraph internal2
updater --> proxy
end
end
end
The API isn't going to be routable from the layer below unless we set the port explicitly, and then bind the same port to the host. I just tested that out and it seems to work. I can put up a PR to allow setting the API's PORT with an environment variable. Then you'll need to pass Docker options like |
This would be wonderful! Thanks for the fast response! |
I would like to confirm that this fix does address the issue. I built the client in my docker container and ran it with the new port specified, and it ran flawlessly. Thank you again! |
@cpswan I was able to get it working under WSL2 using Lines 44 to 46 in 940adb3
I typically default serving to 127.0.0.1 since it's more secure, but for Linux the calls get Strangely though in WSL2 0.0.0.0 doesn't seem to work, but setting it back to 127.0.0.1 does work! It would be nice if this all would just work without messing with environment variables. So someone figures out how to get 127.0.0.1 working on Linux or 0.0.0.0 working on WSL, let me know or put up a PR 😄. |
I'm going to close this out since we have a method for making it work. As I said above, if there are any ideas on making this work without messing with environment variables let me know and PRs welcome! |
I've installed the dependabot cli in Ubuntu 20.04.6 running on WSL2, and whenever I run
dependabot update ...
there seems to be a connection problem with the proxy:lsb_release -a
docker version
docker network ls
The text was updated successfully, but these errors were encountered: