I have dockerfile created in os: rockylinux:8
.
Getting error: /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
Error-
/bin/sh: find: command not found
The command '/bin/sh -c find /usr/share/dashboards' returned a non-zero code: 127
CodePudding user response:
The find
command is not included in the base rockylinux image, you have to install the findutils
package before you can use it.
I just tested, and this works:
FROM rockylinux:8 AS builder
RUN yum install -y findutils
WORKDIR /usr/share/dashboards
RUN find /usr/share/dashboards
Now, its best practice to update the image at the beginning of your build, so you get the latest packages and security patches, so I would actually do this instead:
FROM rockylinux:8 AS builder
RUN yum -y update
RUN yum install -y findutils
WORKDIR /usr/share/dashboards
RUN find /usr/share/dashboards
And later you can optimize this by putting both yum command in the same RUN instruction, and maybe clean up the cache, but this should be enough to get you started.