Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
442 views
in Technique[技术] by (71.8m points)

windows 10 无法从外部访问 WSL2 docker MySQL

我的 docker container 数据如下 , 有开 3306 port

$ docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                               NAMES
74a7e237c26a        mysql               "docker-entrypoint.s…"   4 hours ago         Up 4 hours          0.0.0.0:3306->3306/tcp, 33060/tcp   mysql-test

在WSL2内部测试可以使用 127.0.0.1:3306 连结 MySQL

image-20200909153631022

但在外面用 windows 10 gui 工具测试得到 Connection failed - 102(connection_refused)

image-20200909153550602


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

网络桥接过了吗?

WSL2 跟 Win 是两个独立的网卡,网段默认不互通,跟 WSL1 实现原理不一样。


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...