-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create non-root images #368
Conversation
My concern is that the home directory of |
Would it need to be an actual user instead of |
cc @sharifelgamal This is what I was asking for at Kubecon! thanks @dprotaso |
cc @loosebazooka may want these for Jib as well. |
I added a home directory for the 'nobody' user ( I noticed running tests don't work on Mac
|
@dprotaso run with Provocative question: why don't we make all images be non-root? Is there any reason to have root-based images? |
I'm still not sure if we should reuse |
@loosebazooka what was the original purpose of the 'nobody' user? |
AFAICT, it is sometimes advised to run some processes as |
@dprotaso mostly just historical context. People used it to isolate daemons, but then moved off that to other daemon-specific low-privilege users to isolate the daemons from eachother. I can't really speak to how users are using it now though in distroless, as it doesn't seem like anyone has ever needed a home directory for Maybe I'm being too pedantic about the purpose of |
So outstanding questions for me: Which user/group do folks want to be default in non-root images
Note the Image tagsHow should we reference/upload non-root images to/from a registry. We can tweak tags or repo path. My preference is for change the repo path ie. currently we have
becomes (need to update the PR once consensus is made)
|
It seems sad to make the less secure option the default. I imagine the concern here is breaking existing users so I'm wondering if we have other options. |
Others may have different opinions, but I prefer this. The home of For the uid:gid, I vote for
We could have |
@patflynn making nonroot the default would immediately break anyone depending on it (and there are some niche cases that need it today). If we were starting from scratch (no pun intended), armed with the knowledge we have now, then this would be the default. IMO we should use tags to distinguish these, not repos. If we get these published, and folks (ko, bazel, jib, kubernetes, ...) adopt the explicit tagging by default, then we can see if cc @tallclair @lizrice will be interested in this thread as well |
9917033
to
b9c0ce9
Compare
I love that you’re doing this! +1 to @chanseokoh’s comment preferring a real user rather than nobody. It feels wrong to have a home directory for the nobody account; and in the limited occasions where people deliberately use the nobody account they might even be relying on there not being a home for it. I think for back-compatibility you're right to keep the :latest tag, but you could document it prominently as deprecated to encourage people to use the :root and :nonroot tags |
I think we might still need to decide if we want to move user: |
Would it be worth setting up an distroless-announce@ mailing list? Whether we change the default now or in several months, it's still going to break anybody depending on root who isn't aware of the change. |
@briandealwis I wasn't suggesting that we shouldn't socialize the transition, we should, but it probably makes sense to get any known things onto explicit tags first. I'd love to get this in. @dprotaso ping me if you need anything. |
@mattmoor, any idea what to do with the user-home dir? do we expect users to explicitly be referencing user home instead of through the env? |
@loosebazooka There's no place like |
Unless you are one of those |
Once this PR goes in how long will it take for the images to be available? I'm monitoring this change because we'd like to use distroless with a PodSecurityPolicy with runAsUser:
# Require the container to run without root privileges.
rule: 'MustRunAsNonRoot' |
@donmccasland maybe? |
Sorry for the delay, no idea how this fell off my radar. |
These should be live in 15 minutes or so. |
@sharifelgamal thanks! |
This is required to use newer Bazel versions in CI. Also grpc-gateway needs an update to cope with the use of virtual proto imports in the newer protobuf release, and rules_docker needs to be updated to cope with newer Bazel versions. Updating rules_docker pulled in GoogleContainerTools/distroless#368, which changes the default home directory in the containers to /root, which requires a corresponding change in robot-master.yaml. Change-Id: I958daa2356af795120e6b00a5f37b0c37d49d21d GitOrigin-RevId: 61eedfd
Fixes: #235
@mattmoor @dlorenc @jonjohnsonjr I don't have opinions about how things are tagged. Let me know and I can wrap this up