Home > Net >  How to extend a Docker image that does not have sh binaries
How to extend a Docker image that does not have sh binaries

Time:04-23

I am trying to extend this image https://hub.docker.com/r/hashicorp/waypoint-odr but I can't figure out how to apply any tasks.

Anything I try to run I get the same error ... starting container process caused: exec: "/bin/sh": stat /bin/sh: no such file or directory: unknown

here is an example of minimal Dockerfile

FROM hashicorp/waypoint-odr:latest
RUN pwd

output

Sending build context to Docker daemon  2.048kB
Step 1/2 : FROM hashicorp/waypoint-odr:latest
 ---> 60e7c50c52f0
Step 2/2 : RUN pwd
 ---> Running in 075af9b246f9
failed to create shim: OCI runtime create failed: container_linux.go:380: starting container process caused: exec: "/bin/sh": stat /bin/sh: no such file or directory: unknown

I've tried this as well RUN /bin/ash -c "pwd" but the result is the same.

Do you have any ideas on how I can approach this issue?

CodePudding user response:

It's a bit of an unusual image. The shell is installed in /kaniko/bin, but the Docker SHELL hasen't been set, so it looks for the shell in /bin and fails because it can't find it. You can set the shell and then you should be able to run commands like normal.

FROM hashicorp/waypoint-odr:latest
SHELL ["/kaniko/bin/sh", "-c"]
RUN pwd
  • Related