Building a container using podman issue with crun using /bin/sh instead of sh inside /nix/store

I’m trying to build a container using podman buit it keeps failing when i try to run any bash command to build the image. It looks like this is due to the fact that the OCI runtime is using the wrong path to invoke bash commands. It’s using /bin/sh instead of the one in the /nix/store.

❯ podman build --format docker -t haystack-dev .                                                                                                                                                            haystack-dev -> master ?
STEP 1/4: FROM docker.io/ubuntu/python:3.12-24.04_stable
STEP 2/4: RUN pip install haystack-ai
error running container: from /nix/store/fp3m0k2piiikfax9233dg5648r277h5i-podman-helper-binary-wrapper/bin/crun creating container for [/bin/sh -c pip install haystack-ai]: executable file `/bin/sh` not found: No such file or directory
: exit status 1
Error: building at STEP "RUN pip install haystack-ai": while running runtime: exit status 1

I used the settings in this guide to add sh to the path: Rootless podman setup with Home Manager

  systemd.user.extraConfig = ''
    DefaultEnvironment="PATH=/run/current-system/sw/bin:/run/wrappers/bin:${lib.makeBinPath [ pkgs.bash ]}"
  '';

But I’m still seeing the same issue.

Hello,

Could you please share the DockerFile?

I think the issue it that the process within the container does not find shell and it should try to find /bin/sh instead of a shell under nix-store. The setting you referred is required for a process outside the container.

J