Distroless Java Docker映像错误 [英] distroless java docker image error
问题描述
当我尝试使用distroless java基本映像创建docker映像时,
当我包含诸如'mkdir','chmod'
之类的任何shell命令时,都会出现以下错误:
When I attempt to create a docker image using the distroless java base image, I get the following error when I include any shell command like 'mkdir' , 'chmod' any help on this is really appreciated.
OCI运行时创建失败:container_linux.go:348:启动容器进程导致 exec:\ / bin / sh \:stat / bin / sh:没有这样的文件或目录:未知
OCI runtime create failed: container_linux.go:348: starting container process caused "exec: \"/bin/sh\": stat /bin/sh: no such file or directory": unknown
推荐答案
如果您查看列表中的基本图像中的内容它只是不包含shell,mkdir,chmod或其他类似的东西。 Java映像添加了JVM,就是这样。可能无法基于该图像在预建的jar中完成 COPY
并设置 CMD
指向它,也许可以设置一些默认的 ENV
变量。
If you look at the list of things in the distroless base image it just doesn't include a shell, or mkdir, or chmod, or anything else like that. The Java image adds the JVM, and that's it. It's probably not going to be possible to build an image based on that that does much more than COPY
in a prebuilt jar and set a CMD
to point to it, maybe setting some default ENV
variables along the way.
如果需要标准Linux发行版中包含的基本工具,那么您想从功能更强大的基本映像开始,例如标准 openjdk 图片。
If you need the base tools that are included in a standard Linux distribution, then you want to start from a more featureful base image like the standard openjdk image.
这篇关于Distroless Java Docker映像错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!