MinIO HTTPConnectionPool [Errno -2] 名称或服务未知

MinIO HTTPConnectionPool [Errno -2] Name or service not known

目标:运行 Python 具有 MinIO 访问权限的程序。

我可以通过登录。浏览器,可以上传/编辑文件,与 VPN 断开连接。

Ubuntu WSL在连接时看不到任何套接字,例如我的VPN。

Powershell:

PS C:\> wsl -l -v
NAME STATE VERSION
* Ubuntu Stopped 1

航站楼:

(sdg) me@PF2DCSXD:/mnt/c/Users/me/Documents/GitHub/foo$ poetry run python -m sdg healthcare
Program started
Getting categories from Minio. Bucket: my-bucket
An exception of type MaxRetryError occurred. Arguments:
("HTTPConnectionPool(host='CENSORED.com', port=9000): Max retries exceeded with url: /my-bucket?location= (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fa1083cca00>: Failed to establish a new connection: [Errno -2] Name or service not known'))",)
Make sure to pass in a valid path or an array of categories

(sdg) me@PF2DCSXD:/mnt/c/Users/me/Documents/GitHub/foo$ wget CESNORED.com
--2022-02-17 13:15:39--  http://CENSORED.com:9001/
Resolving CENSORED.com (CENSORED.com)... failed: Name or service not known.
wget: unable to resolve host address ‘CENSORED.com’

(sdg) me@PF2DCSXD:/mnt/c/Users/me/Documents/GitHub/foo$ ss -s
ss: get_sockstat: No such file or directory
ss: get_snmpstat: No such file or directory
Total: 0
TCP:   0 (estab 0, closed 0, orphaned 0, timewait 0)

Transport Total     IP        IPv6
RAW       0         0         0        
UDP       0         0         0        
TCP       0         0         0        
INET      0         0         0        
FRAG      0         0         0 

连接失败

“确保传递有效路径或类别数组”

已更新wsl.conf

$ cat etc/wsl.conf
[network]
generateResolvConf = false

Powershell:

PS C:\Users\me> ipconfig /all

Windows IP Configuration

DNS Servers . . . . . . . . . . . : X.X.X.X

复制 DNS IPv4。

Bash:

sudo nano /etc/resolv.conf

输入 nameserver X.X.X.X 并保存。

Powershell:

PS C:\Users\me> wsl.exe --shutdown

再次打开Bash:

wget <url>

来源:

WSL2 - VPN Fix

Write to resolv.conf