V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
xingcy
V2EX  ›  MacBook Pro

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

  •  
  •   xingcy · 2021-03-05 09:01:27 +08:00 · 2951 次点击
    这是一个创建于 1120 天前的主题,其中的信息可能已经有所发展或是发生改变。
    近期在使用 M1 的 docker 过程中发现容器内的程序无法访问宿主机的 ip+端口,比如容器内要访问宿主机的 mysql 服务使用 host.docker.internal 就不行,不知有没有大佬们遇到并解决的
    6 条回复    2021-03-08 11:56:40 +08:00
    drinkeroftea
        1
    drinkeroftea  
       2021-03-05 09:38:35 +08:00
    macOS 版 docker 可以用 docker.for.mac.host.internal, 并让 mysql 监听 0.0.0.0
    xingcy
        2
    xingcy  
    OP
       2021-03-05 10:39:10 +08:00
    @drinkeroftea 在 Intel 内没问题,M1 里面不行,所以我上面描述的是 M1 的 docker
    guyeu
        3
    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
        4
    xingcy  
    OP
       2021-03-08 09:04:58 +08:00
    @guyeu 没有更新提醒,看修正的日期那应该是我老版本的问题,晚点试试
    guyeu
        5
    guyeu  
       2021-03-08 10:07:26 +08:00
    @xingcy 这个版本不支持应用内更新,每次更新都需要去那个页面下载新版本。
    xingcy
        6
    xingcy  
    OP
       2021-03-08 11:56:40 +08:00
    @guyeu 哈哈,这样子啊,晚点我试试
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   5388 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 07:49 · PVG 15:49 · LAX 00:49 · JFK 03:49
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.