我在os:rockylinux:8中创建了dockerfile。获取错误:/bin/sh: find: command not found
Dockerfile:
FROM rockylinux:8 AS builder
RUN mkdir /usr/share/dashboards
WORKDIR /usr/share/dashboards
RUN find /usr/share/dashboards错误-
/bin/sh: find: command not found
The command '/bin/sh -c find /usr/share/dashboards' returned a non-zero code: 127发布于 2022-09-28 13:48:39
find命令不包含在基本rockylinux映像中,您必须安装findutils包才能使用它。
我刚做了测试,这个很有效:
FROM rockylinux:8 AS builder
RUN yum install -y findutils
WORKDIR /usr/share/dashboards
RUN find /usr/share/dashboards现在,它的最佳实践是在构建开始时更新映像,这样您就可以获得最新的包和安全补丁,因此我实际上会这样做:
FROM rockylinux:8 AS builder
RUN yum -y update
RUN yum install -y findutils
WORKDIR /usr/share/dashboards
RUN find /usr/share/dashboards稍后,您可以通过将两个yum命令放在相同的运行指令中来优化它,并可能清理缓存,但这应该足以让您开始工作。
PS:@DavidMaze在他们的编辑中指出,您的Dockerfile中的mkdir行是多余的,因为WORKDIR指令已经创建了目录。
https://stackoverflow.com/questions/73880818
复制相似问题