&引用;groupadd:找不到命令";在docker容器中,即使我安装了它并且我是root

&引用;groupadd:找不到命令";在docker容器中,即使我安装了它并且我是root,docker,amazon-linux,Docker,Amazon Linux,我有下面的Dockerfile,我想建立。它基本上只是普通的jboss/wildfly基础映像,但使用amazonlinux而不是centOS构建 生成错误在“groupadd:找不到命令”行中消失 在第一次添加“epel”repo并尝试手动安装它之后,您可以在first RUN指令中看到这一点。我读过一些论坛,似乎有时候当你不是以root用户身份运行时会收到错误消息。我做了一个“whoami”,我以root身份运行,所以这不应该是一个问题 有人知道我为什么还出错吗 FROM amazonlin

我有下面的Dockerfile,我想建立。它基本上只是普通的jboss/wildfly基础映像,但使用amazonlinux而不是centOS构建

生成错误在“groupadd:找不到命令”行中消失

在第一次添加“epel”repo并尝试手动安装它之后,您可以在first RUN指令中看到这一点。我读过一些论坛,似乎有时候当你不是以root用户身份运行时会收到错误消息。我做了一个“whoami”,我以root身份运行,所以这不应该是一个问题

有人知道我为什么还出错吗

FROM amazonlinux:2017.03

# Install packages necessary to run EAP
RUN yum-config-manager --enable epel && yum update -y && yum -y install      groupadd xmlstarlet saxon augeas bsdtar unzip && yum clean all

# Create a user and group used to launch processes
# The user ID 1000 is the default for the first "regular" user on Fedora/RHEL,
# so there is a high chance that this ID will be equal to the current user
# making it easier to use volumes (no permission issues)
RUN groupadd -r jboss -g 1000 && useradd -u 1000 -r -g jboss -m -d /opt/jboss -s /sbin/nologin -c "JBoss user" jboss && \
chmod 755 /opt/jboss

# Set the working directory to jboss' user home directory
WORKDIR /opt/jboss

# Specify the user which should be used to execute all commands below
USER jboss

提前谢谢

您的问题是groupadd不是一个包,因此您无法像现在这样安装它

您可以安装shadow-utils.x86_64,这将使groupadd命令可用

yum install shadow-utils.x86_64 -y
或修改您的“跑步”行:

这会解决你的问题


您也不需要epel存储库,因此如果您愿意,您可以一起删除该位。

您可能已经找到了它,但它并不意味着要安装我所说的essentials。您必须构建amazonlinux容器以满足您的需求。您可能仍然缺少其他必要的软件包
RUN yum-config-manager --enable epel && yum update -y && yum -y install      shadow-utils.x86_64 xmlstarlet saxon augeas bsdtar unzip && yum clean all