在WSL实例之间共享Docker守护程序

发布于 2025-02-02 06:28:55 字数 953 浏览 2 评论 0原文

关于在没有Docker桌面的WSL内运行Docker ,有一篇全面的文章在这里。但是,

当涉及到之间,在WSL实例之间共享Docker守护程序时,文章只会触及起始位。这是为了要求整个过程。

首先,为什么要配置它以使用共享 /MNT /WSL目录中存储的插座,而不是通常建议从Docker公开2375端口?我要问的是,我发现找到可以用作不同WSL实例之间共享 /MNT /WSL目录的东西很具有挑战性但是,本能是行不通的。我尝试了一下,尝试呼叫mknod以创建设备文件在NTFS共享文件夹中,got:

mknod:/mnt/d/foobar:不支持操作

因为 ,,,,

问题是Docker在2375年运行,但仅在某些设置(WSL2 Backend / Linux容器)中绑定了Localhost < / p>

它吗?但是,即使如此,我上述情况也很好,因为我只在同一Localhost上的WSL实例之间共享Docker守护程序。

因此,这是为了提供一个全面的解决方案,用于在WSL实例之间共享Docker守护程序,这是实用的,任何人都可以遵循。谢谢!

Regarding running Docker from within WSL without Docker Desktop, there is a comprehensive article here. However,

When it comes to sharing the Docker daemon between WSL instances, the article only touches the starting bits. This is to ask for the whole process.

First of all, why configuring it to use a socket stored in the shared /mnt/wsl directory, instead of commonly suggested exposing the 2375 port from docker? The reason I'm asking is that I found it challenging to find something to be used as the shared /mnt/wsl directory between different WSL instances, as trying to make use of exiting Windows drive (ntfs share mount) will be peoples' first instinct, however, it won't work. I tried that, trying to call mknod to create a device file in ntfs shared folder, and got:

mknod: /mnt/d/foobar: Operation not supported

Is it because,

The issue is that Docker runs in 2375 but its bound just for localhost in some setups (WSL2 backend / Linux container)

Is it still true? But even that, it's fine with my above case as I'm only sharing the Docker daemon between WSL instances on the same localhost.

So, this is to ask for a total solution for sharing the Docker daemon between WSL instances, that is practical and anyone can follow. thx!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文