You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Consider having the default distroless tags use non-root user by default #374
Cool! Looks like I can take this as a definite answer that you actually do not have any objection on this issue. I initially thought you were opposing, as you had asked for "reconsideration" on this matter. Switching the default won't affect your situation, after all.
It would be more useful if you also have an image :nonroot-with-setcap, to make some people's life easier.
Definitely, this is something conceivable, but to be completely honest, I think this isn't really the right direction for Distroless (or any other similar base images) to take and maintain it, for a number of reasons. But primarily, this setcap issue (moby/moby#35699) should really be fixed at the root. Actually, looking at the bug, they seem to agree that this should be resolved at the Docker level in today's environment, and indeed, they are actively working on this (draft PR here) to resolve the issue.
I need to copy setcap and its shared objects from a burster image?
Inquiry: Is it possible to, in an image or Dockerfile using Distroless, besides the ':nonroot' tag, also define a 'USER nonroot'? This is because, when scanning images with Trivy, it does not detect root, and as a consequence, it generates a HIGH vulnerability.
Sorry for reopening an old thread, but I've run into what I believe is the same issue as @JonathanParra. Our Trivy scan reports:
Dockerfile (dockerfile)
Tests: 20 (SUCCESSES: 19, FAILURES: 1)
Failures: 1 (HIGH: 1, CRITICAL: 0)
AVD-DS-0002 (HIGH): Specify at least 1 USER commandin Dockerfile with non-root user as argument
For this container:
FROM gcr.io/distroless/nodejs24-debian12:nonroot
WORKDIR /app
COPY --from=build /app .
CMD ["app.js"]
It seems Trivy does not detect this as a non-root container. Or am I maybe missing something?
Activity
Renz2018 commentedon Jun 24, 2019
How about add java:8-nonroot and java:11-nonroot???
evanj commentedon Sep 16, 2019
The switch to debian10 would actually be an opportunity to introduce this change, since it is going to break compatibility anyway?
yegle commentedon Nov 8, 2019
chanseokoh commentedon Nov 8, 2019
yegle commentedon Nov 8, 2019
chanseokoh commentedon Nov 8, 2019
yegle commentedon Nov 8, 2019
chanseokoh commentedon Nov 8, 2019
yegle commentedon Nov 9, 2019
chanseokoh commentedon Nov 9, 2019
Cool! Looks like I can take this as a definite answer that you actually do not have any objection on this issue. I initially thought you were opposing, as you had asked for "reconsideration" on this matter. Switching the default won't affect your situation, after all.
Definitely, this is something conceivable, but to be completely honest, I think this isn't really the right direction for Distroless (or any other similar base images) to take and maintain it, for a number of reasons. But primarily, this
setcapissue (moby/moby#35699) should really be fixed at the root. Actually, looking at the bug, they seem to agree that this should be resolved at the Docker level in today's environment, and indeed, they are actively working on this (draft PR here) to resolve the issue.That is one way to do it. Another option I can think of is rebasing (https://github.com/google/go-containerregistry/blob/master/cmd/crane/rebase.md, https://github.com/google/image-rebase, or https://github.com/codahale/docker-rebase), and this may be an easier approach to some people. Another workaround I found is to import a tarball, and perhaps this may also prove easier. I believe many people have hit this issue, so there may be more workarounds, I don't know.
JonathanParra commentedon Dec 19, 2023
Inquiry: Is it possible to, in an image or Dockerfile using Distroless, besides the ':nonroot' tag, also define a 'USER nonroot'? This is because, when scanning images with Trivy, it does not detect root, and as a consequence, it generates a HIGH vulnerability.
loosebazooka commentedon Dec 20, 2023
I'm not sure I understand the problem? Can you elaborate? The users are in all images. The tag is just setting the default user.
rudfoss-rr commentedon Nov 14, 2025
Sorry for reopening an old thread, but I've run into what I believe is the same issue as @JonathanParra. Our Trivy scan reports:
For this container:
It seems Trivy does not detect this as a non-root container. Or am I maybe missing something?