在 ZFS 文件系统上使用 docker 无根模式的正确方法

发布于 2025-01-11 22:47:23 字数 704 浏览 0 评论 0原文

我将我的 docker 配置为与无根模式一起使用,并且工作正常。但我更改了数据目录,将所有 docker 的数据存储在 zfs 文件系统中。看来它不能直接工作,我正在寻找正确的方法来设置我的系统。

存储驱动程序配置良好,我收到以下错误

docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
2db29710123e: Extracting [==================================================>]  2.479kB/2.479kB
docker: failed to register layer: exit status 1: "/sbin/zfs fs create -o mountpoint=legacy xxxx/main/3a2069b67391755d42342cbfa9c0a78cb779759787e219bd8a80c4c2d51c2e96" => cannot create 'xxxx/main/3a2069b67391755d42342cbfa9c0a78cb779759787e219bd8a80c4c2d51c2e96': permission denied

我认为此错误完全正常,但我们如何强制安全地允许在没有 root 权限的情况下创建挂载点。

I configure my docker to be used with rootless mode and it works fine. But I changed my data-dir to store all the docker's data in a zfs filesystem. It appears that it is not working directly and I am looking for the right way to setup my system.

The storage driver is well configured and I obtain the following error

docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
2db29710123e: Extracting [==================================================>]  2.479kB/2.479kB
docker: failed to register layer: exit status 1: "/sbin/zfs fs create -o mountpoint=legacy xxxx/main/3a2069b67391755d42342cbfa9c0a78cb779759787e219bd8a80c4c2d51c2e96" => cannot create 'xxxx/main/3a2069b67391755d42342cbfa9c0a78cb779759787e219bd8a80c4c2d51c2e96': permission denied

I assumed that this error is completely normal but how can we force securely to allow to create mountpoint without root rights.

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

燃情 2025-01-18 22:47:23

ZFS 2.2.0 起(2023 年 10 月 13 日) ),overlayfs 在 zfs 文件系统之上受支持:

Linux 容器支持(#12209、#14070、#14097、#12263) - 增加了对 Linux 特定容器接口的支持,例如 renameat(2)、overlayfs 支持、用户命名空间中的 idmapped 挂载以及命名空间委派支持对于容器。

这意味着只要您选择 overlay2 存储驱动程序,您就可以在 ZFS 文件系统上拥有 /var/lib/docker (或其无根等效项)。

提供自己的 ZFS 版本的系统,例如 TrueNAS (Core/Scale)、Proxmox 虚拟环境 (Proxmox VE) 和 NixOS 可能不会立即提供 2.2.0 版本 - 截至撰写本文时(2023 年 10 月 25 日),Proxmox VE (v8.0.2-7) 仍在 zfs-2.1.13-pve1 上并且zfs-kmod-2.1.12-pve1

As of ZFS 2.2.0 (Oct. 13, 2023), overlayfs is supported on top of a zfs filesystem:

Linux container support (#12209, #14070, #14097, #12263) - Added support for Linux-specific container interfaces such as renameat(2), support for overlayfs, idmapped mounts in a user namespace, and namespace delegation support for containers.

This means that you can have /var/lib/docker (or it's rootless equivalent) on a ZFS filesystem, as long as you select the overlay2 storage driver.

Systems which provide their own ZFS builds such as TrueNAS (Core/Scale), Proxmox Virtual Environment (Proxmox VE) and NixOS may not have release 2.2.0 available immediately - at the time of writing (Oct. 25, 2023), Proxmox VE (v8.0.2-7) is still on zfs-2.1.13-pve1 and zfs-kmod-2.1.12-pve1.

柳絮泡泡 2025-01-18 22:47:23

遗憾的是,rootless 不支持 zfs 存储驱动程序

https://docs.docker.com/ engine/security/rootless/

已知限制

The zfs storage driver is unfortunately not supported in rootless

From https://docs.docker.com/engine/security/rootless/

Known limitations????

Only the following storage drivers are supported:

  • overlay2 (only if running with kernel 5.11 or later, or
    Ubuntu-flavored kernel)
  • fuse-overlayfs (only if running with kernel 4.18 or later, and fuse-overlayfs is installed)
  • btrfs (only if running with kernel 4.18 or later, or ~/.local/share/docker is mounted with user_subvol_rm_allowed mount
    option)
  • vfs
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文