Description
Description
Originally, I observed this with a mongodb container. The image user is mongodb
and there is a group mongodb
, but it's not the primary group of the user (nogroup
is). containerd omits the mongodb
group from the supplemental GID list.
Steps to reproduce the issue
- Create a GCP Debian Bookworm VM.
- Install latest k3s (v1.32.5+k3s1, comes with containerd v2.0.5-k3s1.321).
- Apply a specially crafted reproducer (source: https://github.com/burgerdev/weird-images/tree/74b32e2/src/gid)
kubectl apply -f https://raw.githubusercontent.com/burgerdev/weird-images/74b32e268da916576f307f6f997ae289322f5aa6/src/gid/gid.yaml
Describe the results you received and expected
Observed
In the container logs, I see the UID, GID and supplemental groups:
Uid: 2 2 2 2
Gid: 1 1 1 1
Groups: 1
Expected
The process should also have the supplemental group 2 (name
).
What version of containerd are you using?
v2.0.5-k3s1.32
Any other relevant information
MongoDB setup
Image that I used when I discovered the bug: quay.io/mongodb/mongodb-community-server@sha256:8b73733842da21b6bbb6df4d7b2449229bb3135d2ec8c6880314d88205772a11
The unusual group setup comes from here, afaict:
containerd bug
I assume it's this snippet that triggers the bug
containerd/pkg/oci/spec_opts.go
Lines 851 to 854 in bcd000f
The code seems to assume that a group with the same name as the user is always the primary group of the user.
It might be possible to just delete this check, given that the primary ID is always added
containerd/pkg/oci/spec_opts.go
Line 833 in bcd000f
but only if it hasn't been added already
containerd/pkg/oci/spec_opts.go
Lines 127 to 135 in bcd000f
Show configuration if it is related to CRI plugin.
No response
Footnotes
-
This was the simplest way for me to reproduce the bug. I know that it's a bit removed from upstream containerd main, but since I believe to have found the root cause (see last section), it may be sufficient as a demo. ↩
Metadata
Metadata
Assignees
Type
Projects
Status