gpt4 book ai didi

docker - k8s securityContext.runAsUser与Dockerfile USER指令

转载 作者:行者123 更新时间:2023-12-02 11:30:53 24 4
gpt4 key购买 nike

在我的k8s部署的securityContext.runAsUser部分中选择要运行的用户与在Dockerfile中使用USER myuser指定用户之间有什么区别?

我特别感兴趣是否存在与USER myuser下不存在的securityContext相关的安全性问题

最佳答案

MustRunAsNonRoot

Users and groups

Requires that the pod be submitted with a non-zero runAsUser or have the USER directive defined (using a numeric UID) in the image. Pods which have specified neither runAsNonRoot nor runAsUser settings will be mutated to set runAsNonRoot=true, thus requiring a defined non-zero numeric USER directive in the container. No default provided. Setting allowPrivilegeEscalation=false is strongly recommended with this strategy.



因此,当您希望以非 super 用户身份启动容器时, USER directive很重要。

关于docker - k8s securityContext.runAsUser与Dockerfile USER指令,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56908562/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com