Sol*_*lie 7 docker amazon-linux
我有下面想要构建的Dockerfile.它基本上只是普通的jboss/wildfly基本图像,但是用amazonlinux而不是centOS构建.
构建错误出现"groupadd:Command not found"行
发生这种情况后,我第一次添加"epel"仓库,并尝试手动安装,如您在第一个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
Run Code Online (Sandbox Code Playgroud)
提前致谢!
sj.*_*yer 13
您的问题是groupadd不是一个包,因此您无法像现在尝试那样安装它.
您可以安装shadow-utils.x86_64,这将使groupadd命令可用.
yum install shadow-utils.x86_64 -y
Run Code Online (Sandbox Code Playgroud)
或者修改"RUN"行:
RUN yum-config-manager --enable epel && yum update -y && yum -y install shadow-utils.x86_64 xmlstarlet saxon augeas bsdtar unzip && yum clean all
Run Code Online (Sandbox Code Playgroud)
那应该可以解决你的问题.
您也不需要epel存储库,因此如果需要,您可以一起删除该位.
| 归档时间: |
|
| 查看次数: |
5898 次 |
| 最近记录: |