Podman fails on build with any RUN command in Containerfile on fresh Rocky Install

Hi, I have a fresh install of Rocky 9.5.

Also I have a container file that looks like this:

FROM rockylinux:9
COPY . .
RUN dnf -y update && dnf -y install git  && dnf clean all
WORKDIR /buildbox
USER buildbox
ENTRYPOINT [ "sleep", "infinity" ]

I get this error on build command: podman build -t buildbox1 .:

STEP 3/7: RUN dnf -y update && dnf -y install git  && dnf clean all
error running container: from /usr/bin/crun creating container for [/bin/sh -c dnf -y update && dnf -y install git  && dnf clean all]: executable file `/bin/sh` not found in $PATH: No such file or directory
: exit status 1
ERRO[0000] did not get container create message from subprocess: EOF
Error: building at STEP "RUN dnf -y update && dnf -y install git  && dnf clean all": while running runtime: exit status 1

This is not my experience on other vendors. I don’t know where to start, because I haven’t done anything on the system yet that would cause it. (It’s so new) so don’t know what to roll back.

Things I’ve done:

  • I’ve turned of selinux.
  • I’ve tried with Fedora FROM quay.io/fedora/fedora:41/0 and Rocky images, get the same error.
  • if I run podman run hello it works as expected. So doubly lost.
  • I get this error anytime I do aRUN from any image. If I take out the RUN it builds and runs fine, I can exec to bash.
  • podman run --rm -it quay.io/fedora/fedora:41 ls -l /bin/sh works

Any suggestions on how to resolve this? Thx

UPDATE:

  • added another step to things I’ve done.
  • It looks like the COPY . . is causing the problem, not sure how, and it seems weird. So probably not a Rocky Problem. Leave it up if anyone has any insight

I believe the copy command should be more specific than what you have used. It may also not like the fact you are attempting to copy files where the Dockerfile is located. It would be better if you are wanting to copy multiple files, to use something like:

COPY nginx-conf/* /etc/nginx/conf.d/

as an example by storing the files to be copied in a sub-directory where your Dockerfile exists.

yes it was the circular ref of copying files on to itself which wasn’t obvious to me. The error message had me going down the wrong path. Thx

1 Like