1

我是 docker/podman 的新手。我能够创建基本图像,并将东西放入其中(即 java、mongodb 等),然后让它们运行。但是对于我的生活,我似乎无法在 podman 映像中创建用户帐户。我在谷歌上到处搜索,这就是我在这里的原因。

系统/平台:

centos8

Dockerfile:

FROM fedora:latest 
RUN useradd --uid 1000 --user-group -s /bin/bash stress
USER stress
ENTRYPOINT ["/bin/bash"] nter code here

命令:

[stress@localhost PodmanImages]$ podman build .
STEP 1: FROM fedora:latest
Getting image source signatures
Copying blob 00c5bb959822 done
Copying config 8c2e0da7c4 done
Writing manifest to image destination
Storing signatures
STEP 2: RUN useradd --uid 1000 --user-group -s /bin/bash stress
useradd: /etc/passwd.1: lock file already used
useradd: cannot lock /etc/passwd; try again later.
Error: error building at STEP "RUN useradd --uid 1000 --user-group -s /bin/bash stress": 
error while running runtime: exit status 1

当我实际进入从图像创建的容器并尝试运行 useradd 命令时,我得到了同样的错误。

[stress@localhost PodmanImages]$ podman run --rm --name game -it 
registry.fedoraproject.org/fedora /bin/bash
[root@c43c5df75db6 /]# useradd --uid 1000 --user-group -s /bin/bash stress
useradd: /etc/passwd.20: lock file already used
useradd: cannot lock /etc/passwd; try again later.
[root@c43c5df75db6 /]# exit
exit
[stress@localhost PodmanImages]$

我已经删除了在容器中创建的锁定文件,并尝试再次运行 useradd 命令,但它一直显示相同的错误。

如果有人能够为我阐明这一点,我会非常高兴!

非常感谢您的考虑!

4

1 回答 1

0

fuse-overlayfs中的一个错误现已修复,但该错误修复尚未进入 Centos 8。

作为一种解决方法,您可以将命令行选项--storage-driver=vfs作为第一个命令行参数添加到 podman。例如

podman --storage-driver=vfs build .

该解决方案在 Centos 8 上对我有用。

于 2020-05-05T11:30:47.007 回答