简体   繁体   English

未找到 Google Distroless 映像 chmod?

[英]Google Distroless image chmod not found?

I am using this:我正在使用这个:

FROM gcr.io/distroless/python3-debian11

When I build my docker file,当我构建我的 docker 文件时,

 > [stage-1 6/6] RUN /chmod +x /scripts/main:
#17 0.204 /bin/sh: 1: /chmod: not found

Why is chmod and ls not found?为什么找不到 chmod 和 ls?

When I try to ls inside the container:当我尝试在容器内 ls 时:

# /bin/sh ls
/bin/sh: 0: cannot open ls: No such file

That is intentional.那是故意的。 Conceptionally, there is nothing inside the image.从概念上讲,图像内部没有任何内容。 It's not as bare-bones as scratch but close.它不像scratch那样简单,而是接近。

If you need to perform some work, do it up front in another stage.如果您需要执行某些工作,请在另一个阶段提前完成。

FROM python 
RUN chmod +x /tmp/foo

FROM gcr.io/distroless/python3-debian11
COPY --from=0 /tmp/foo /opt/app 

That said, in your case you may be able to get away with也就是说,在您的情况下,您可能会逃脱

FROM gcr.io/distroless/python3-debian11
COPY --chmod=755 /my/local/script.py /opt/app.py

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM