如何扩展没有 sh 二进制文件的 Docker 图像

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

我正在尝试扩展此图像 https://hub.docker.com/r/hashicorp/waypoint-odr 但我不知道如何应用任何任务。

我尝试的任何操作 运行 我都得到同样的错误 ... starting container process caused: exec: "/bin/sh": stat /bin/sh: no such file or directory: unknown

这里有一个最小 Dockerfile 的例子

FROM hashicorp/waypoint-odr:latest
RUN pwd

输出

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

我也试过了RUN /bin/ash -c "pwd"但是结果是一样的。

你对我如何处理这个问题有什么想法吗?

这张图片有点不寻常。 shell安装在/kaniko/bin中,但是DockerSHELL没有设置,所以在/bin中寻找shell,失败,因为找不到它。您可以设置 shell 然后您应该能够像正常一样执行 运行 命令。

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