You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

基于rockylinux:8的Dockerfile执行find命令报错:find: command not found

解决Rocky Linux 8 Docker镜像中find命令找不到的问题

Rocky Linux 8的基础镜像是最小化版本,默认没有预装find命令——这个命令属于findutils软件包,所以构建时会出现找不到命令的错误。

修改后的Dockerfile如下:

FROM rockylinux:8 AS builder

RUN dnf install -y findutils && dnf clean all
RUN mkdir /usr/share/dashboards
WORKDIR /usr/share/dashboards
RUN find /usr/share/dashboards

说明:

  • dnf install -y findutils用来安装包含find命令的软件包,dnf clean all用于清理包缓存,避免镜像体积过大
  • 安装完成后,后续的find命令即可正常执行

原问题中的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

内容的提问来源于stack exchange,提问作者Divyank

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.18 07:30:22