【发布时间】:2022-12-15 20:52:42
【问题描述】:
Distroless images 有 3 个用户:
> docker run --rm --entrypoint cat gcr.io/distroless/nodejs:debug /etc/passwd
root:x:0:0:root:/root:/sbin/nologin
nobody:x:65534:65534:nobody:/nonexistent:/sbin/nologin
nonroot:x:65532:65532:nonroot:/home/nonroot:/sbin/nologin
如果您在没有 USER 指令的情况下运行图像文件图像运行为uid=0(根) gid=0(根).
我想避免这种情况并使用非特权用户。
以外没有人没有 /home 目录,在我的 Dockerfile 中使用 USER nobody 和 USER nonroot 有什么区别?
【问题讨论】:
标签: linux docker dockerfile privileges distroless