我在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
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命令放在同一条RUN指令中进行优化,并可能清理缓存,但这应该足以让您开始。
PS:在他们的编辑中,@DavidMaze指出Dockerfile中的mkdir
行是多余的,因为WORKDIR
指令已经创建了目录。