Eva*_*oll 6 tar chmod namespace podman
当我运行时podman run
,我遇到了一个特别奇怪的错误,
\xe2\x9d\xaf podman run -ti --restart=unless-stopped -p 80:80 -p 443:443 rancher/rancher:latest\n\xe2\x9c\x94 docker.io/rancher/rancher:latest\nTrying to pull docker.io/rancher/rancher:latest...\nGetting image source signatures\n[... blob copying...]\nWriting manifest to image destination\nStoring signatures\n Error processing tar file(exit status 1): potentially insufficient UIDs or GIDs available in user namespace (requested 630384594:600260513 for /usr/bin/etcdctl): Check /etc/subuid and /etc/subgid: lchown /usr/bin/etcdctl: invalid argument\nError: Error committing the finished image: error adding layer with blob "sha256:b4b03dbaa949daab471f94bcfd68cbe21c1147e8ec2acfe3f46f1520db48baeb": Error processing tar file(exit status 1): potentially insufficient UIDs or GIDs available in user namespace (requested 630384594:600260513 for /usr/bin/etcdctl): Check /etc/subuid and /etc/subgid: lchown /usr/bin/etcdctl: invalid argument\n
Run Code Online (Sandbox Code Playgroud)\n“用户命名空间中可用的 UID 或 GID 可能不足”是什么意思以及如何解决此问题?
\nEva*_*oll 10
为了解决这个问题,我必须运行--storage-opt ignore_chown_errors=true
这个忽略 chmod 错误并强制您的容器仅支持一个用户。您可以在“Why can\xe2\x80\x99t rootless Podman pull my image?”中阅读相关内容。。请注意,这是一个选项podman
,而不是 to podman run
。因此使用它看起来像这样,
podman --storage-opt ignore_chown_errors=true run [....]\n
Run Code Online (Sandbox Code Playgroud)\n就我而言,因为我没有内核overlayfs驱动程序,所以我需要使用FUSE版本(使用安装 sudo apt install fuse-overlayfs
),
podman --storage-opt mount_program=/usr/bin/fuse-overlayfs --storage-opt ignore_chown_errors=true run [....]\n
Run Code Online (Sandbox Code Playgroud)\n
小智 9
已经接受的答案让我去寻找一个可以为所有 podman 调用产生相同结果的全局设置。这对我来说非常重要,因为 podman 是由另一个我不拥有的脚本调用的。
中有一个相应的标志(ignore_chown_errors
)/etc/containers/storage.conf
,在我的系统中被注释掉了,所以我在文件中添加了以下行:
ignore_chown_errors = "true"
Run Code Online (Sandbox Code Playgroud)
通过此更改,系统中的所有 podman 调用开始正常工作,而无需向每个调用添加标志--storage-opt ignore_chown_errors=true
。
PS:我的文件系统没有问题,所以我没有尝试更改mount_program
该配置文件中的设置,但我认为它在所有调用中都会产生相同的全局效果。