Repository navigation
[release-1.0] Cherry-pick #2392: Run containers as the image's USER and WORKDIR, with layer file owners kept - #3473
Merged
Dmitry Berkovich (dberkov) merged 1 commit intoOct 30, 2026
Conversation
…s kept (agent-substrate#2392) Containers ignored the image's `USER` and `WORKDIR` and ran as root in `/`, and atelet's unpack dropped the file owners image layers record. So an image that hands a directory to its user, such as jupyter's `/home/jovyan`, didn't work as built. - atelet applies each tar entry's uid/gid and keeps setuid, setgid and sticky bits. It adds `CHOWN`, `FOWNER` and `FSETID` to its `DAC_OVERRIDE`. The image cache layout moves to version 3. - The process runs as the image's `USER`, resolved as Docker does against the image's own `/etc/passwd` and `/etc/group`, and starts in its `WORKDIR` (default `/`). - The jupyter demo runs as jovyan and drops `DAC_OVERRIDE` and `--allow-root`. The `USER` and `WORKDIR` commits are @dims's from agent-substrate#1918, kept as written. This PR supersedes agent-substrate#1918. Fixes agent-substrate#2036 #### Breaking change Please add the `breaking-change` label. - After an upgrade or rollback, atelet refuses the existing image cache. Delete `/var/lib/ate/image-cache` on each node once no actor runs on it, as atelet's error says. After an upgrade, a node reboot also works. - A custom atelet securityContext needs `CHOWN`, `DAC_OVERRIDE`, `FOWNER` and `FSETID`. - Images with a `USER` stop running as root, and images with a `WORKDIR` stop starting in `/`. A non-root `USER` is expected to have no effective capabilities, so `securityContext.capabilities.add` no longer helps it. This is checked under runc and in the gVisor source, not yet inside a gVisor or microVM sandbox. - gVisor snapshots of such images don't restore, because `runsc restore` checks each container's user and working directory. Recreate those templates. MicroVM snapshots resume as they were. - Files an earlier run wrote as root into a durable dir stay root-owned. Tested: `go test -race` on atelet, imagecache, ocispec, tarutil, kata and the probe fixture, on macOS and on Linux as non-root, and imagecache with `-count=3 -shuffle=on`. The root-only imagecache and tarutil tests pass as root on a privileged Linux container. `hack/verify-all.sh` passes. The jupyter image serves `/api` under Docker as 1000:100 with every capability dropped. @dims ran the jupyter demo and a non-root node image as their users on kind, on both runtimes, before agent-substrate#1904 merged; on microVM uid 1000 couldn't bind :80 then. A new imagefs e2e starts an actor from a probe image with `USER nonroot:nonroot` and `WORKDIR /home/nonroot`. It checks uid and gid 65532, no supplementary group besides 65532, no effective capabilities, the working directory, and that the user can create a file there. CI runs it on gVisor and on microVM. At this head nothing ran in a gVisor or microVM sandbox yet: not the jupyter demo and not the imagefs e2e. - [ ] Tests pass - [x] Docs updated --------- Signed-off-by: Anish Ramasekar <[email protected]> Signed-off-by: Davanum Srinivas <[email protected]> Co-authored-by: Davanum Srinivas <[email protected]> (cherry picked from commit 5d226a5) Signed-off-by: Benjamin Elder <[email protected]>
Davanum Srinivas (dims)
approved these changes
Oct 30, 2026
Dmitry Berkovich (dberkov)
approved these changes
Oct 30, 2026
Dmitry Berkovich (dberkov)
merged commit Oct 30, 2026
0c662eb
into
agent-substrate:release-1.0
9 checks passed
16 of 23 tasks
This was referenced Nov 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Cherry-pick of #2392 onto
release-1.0(git cherry-pick -xof the squash commit), it applied cleanly with no changes.Containers run as the image's
USERand start in itsWORKDIR, and atelet keeps the file owners recorded in image layers. Fixes #2036 for 1.0.AI use: AI-assisted. Clean pick.
This carries the same breaking changes as #2392:
After an upgrade or rollback, atelet refuses the existing image cache. Delete
/var/lib/ate/image-cacheon each node once no actor runs on it, as atelet's error says. After an upgrade, a node reboot also works.A custom atelet securityContext needs
CHOWN,DAC_OVERRIDE,FOWNERandFSETID.Images with a
USERstop running as root, and images with aWORKDIRstop starting in/. A non-rootUSERhas no effective capabilities, sosecurityContext.capabilities.addno longer helps it.gVisor snapshots of such images don't restore, because
runsc restorechecks each container's user and working directory. Recreate those templates. MicroVM snapshots resume as they were.Files an earlier run wrote as root into a durable dir stay root-owned.
Tests pass
Docs updated