M1 的 docker 容器内无法访问宿主机 ip?

2021-03-05 09:01:27 +08:00
 xingcy
近期在使用 M1 的 docker 过程中发现容器内的程序无法访问宿主机的 ip+端口,比如容器内要访问宿主机的 mysql 服务使用 host.docker.internal 就不行,不知有没有大佬们遇到并解决的
3006 次点击
所在节点    MacBook Pro
6 条回复
drinkeroftea
2021-03-05 09:38:35 +08:00
macOS 版 docker 可以用 docker.for.mac.host.internal, 并让 mysql 监听 0.0.0.0
xingcy
2021-03-05 10:39:10 +08:00
@drinkeroftea 在 Intel 内没问题,M1 里面不行,所以我上面描述的是 M1 的 docker
guyeu
2021-03-06 10:38:23 +08:00
这个 bug 不是已经修掉了吗,老兄试试最新版?

以下摘自官网:

Fixes since the Apple Silicon preview 7
Docker Desktop preview 3.1.0 (60984)

2021-02-11

Kubernetes now works (although you might need to reset the cluster in our Troubleshoot menu one time to regenerate the certificates).
osxfs file sharing works.
The host.docker.internal and vm.docker.internal DNS entries now resolve.
Removed hard-coded IP addresses: Docker Desktop now dynamically discovers the IP allocated by macOS.
The updated version includes a change that should improve disk performance.
The Restart option in the Docker menu works.
xingcy
2021-03-08 09:04:58 +08:00
@guyeu 没有更新提醒,看修正的日期那应该是我老版本的问题,晚点试试
guyeu
2021-03-08 10:07:26 +08:00
@xingcy 这个版本不支持应用内更新,每次更新都需要去那个页面下载新版本。
xingcy
2021-03-08 11:56:40 +08:00
@guyeu 哈哈,这样子啊,晚点我试试

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/758659

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX