-
Notifications
You must be signed in to change notification settings - Fork 7.5k
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
[Bug]: 在windows使用WSL2的docker时,代理设置建议 #874
Comments
谢谢反馈 |
实际上是每次要获得主机 ip,如果写在config中,main.py在子系统中运行,应该是获得了WSL-Ubuntu自己的IP,您可能需要修改表述,或建议大家用miniconda之类的方法避免网络设置 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Installation Method | 安装方法与平台
Docker(Windows/Mac)
Version | 版本
Latest | 最新版
OS | 操作系统
Windows
Describe the bug | 简述
相关材料:https://learn.microsoft.com/zh-cn/windows/wsl/networking
简述:
现在新的 windows 使用的虚拟机机制是 WSL 2 ,他的网络工作与 WSL 不同,因此使用 docker + WSL 的设置代理也不同。
解决方案:
在win主机使用命令行工具,输入
ipconfig
,复制自己的 ipv4 ,使得有如下形式的代理:协议
+主机ip
+端口
可能无法通过 check_proxy 检查,但不影响使用
原理叙述:
WSL2 有一个带有其自己独一无二的 IP 地址的虚拟化以太网适配器。这意味着他和主机不在同一个网络中,而是自成一体。
一个证据是当你在主机输入
ipconfig
时,能看到 WSL 有一个单独的网络配置和 ip 地址。由于不在一个网络中,无论是自环ip(127.0.0.1)还是(localhost)都只能指向 WSL2 自己的虚拟机 ip 地址而不是主机的,代理也随之失效。
因此,通过(局域网)主机 ip 访问主机的端口(记得放行防火墙),这样就可以走主机的代理了。
讨论:
以下一个可能的解决方案
Screen Shot | 有帮助的截图
Terminal Traceback & Material to Help Reproduce Bugs | 终端traceback(如有) + 帮助我们复现的测试材料样本(如有)
No response
The text was updated successfully, but these errors were encountered: