fix(docker): support non-root runtime execution - #2560
Merged
Conversation
ko3n1g
force-pushed
the
fix/docker-rootless-runtime
branch
from
August 14, 2026 23:00
ca89f84 to
797acd8
Compare
cmunley1
previously approved these changes
Aug 17, 2026
thomasdhc
requested changes
Aug 17, 2026
thomasdhc
left a comment
There was a problem hiding this comment.
Changes requested.
Review notes
- Server venvs resolve to
<server_dir>/.venvunder/opt/nemo-gymand the server uv cache to/opt/nemo-gym/cache/uv, which matches the runtimeUV_CACHE_DIRthis image now sets. global_config.pypins server venvs to the running interpreter version, souv venv --pythonnever has to write a new managed Python into the root-owned/opt/uv/pythonat runtime.
| RUN venv_site_packages="$(/opt/nemo_gym_venv/bin/python -c \ | ||
| 'import site; print(site.getsitepackages()[0])')" && \ | ||
| touch "${venv_site_packages}/.nonroot-uninstall-probe" && \ | ||
| chown -R "${RUNTIME_UID}:${RUNTIME_GID}" /opt/nemo-gym && \ |
There was a problem hiding this comment.
[P2] Findings: this recursive chown runs in a layer after the gym env prefetch RUN that created /opt/nemo-gym/cache/uv and the per-server <server_dir>/.venv trees, and OCI layer diffs carry no metadata-only delta, so any build passing --build-arg NEMO_GYM_PREFETCH_CONFIGS=... rewrites that multi-GB content in full into a second layer. Proposal: apply the runtime ownership inside the prefetch RUN so this final RUN only covers the source tree, matching the find ... -type d treatment already used for /opt/nemo_gym_venv.
Signed-off-by: oliver könig <okoenig@nvidia.com>
Signed-off-by: oliver könig <okoenig@nvidia.com>
Signed-off-by: oliver könig <okoenig@nvidia.com>
Signed-off-by: oliver könig <okoenig@nvidia.com>
Signed-off-by: oliver könig <okoenig@nvidia.com>
Signed-off-by: oliver könig <okoenig@nvidia.com>
ko3n1g
force-pushed
the
fix/docker-rootless-runtime
branch
from
August 18, 2026 08:33
d9851b9 to
17a5295
Compare
thomasdhc
approved these changes
Aug 18, 2026
thomasdhc
left a comment
There was a problem hiding this comment.
LGTM.
Review notes
- Runtime ownership of
/opt/nemo-gym/cacheand prefetched server.venvtrees is now applied inside the RUN that creates them, so prefetched layers are no longer duplicated by the final ownership pass. - The in-build UID 65532 stage proves the CLI, uv toolchain, project environment, and cache/results/site-packages writability, and the final instruction restores root as the published default.
ko3n1g
enabled auto-merge (squash)
August 18, 2026 20:16
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.
Background / motivation
/root, and runtime paths were root-owned.What changed
uvanduvxrelease archives in/usr/local/binafter architecture-specific SHA-256 verification, with managed Python under/opt/uv/python.RUNTIME_UIDandRUNTIME_GIDbuild arguments, defaulting to65532:65532./home/nemo-runtime.USER root..venvcontent from Docker build contexts.uvarchive checksums for the change-set secrets scan.Details
--user 65532:65532and explicitly setHOME=/home/nemo-runtimeandXDG_CACHE_HOME=/opt/nemo-gym/cache/xdg./opt/uv/cache./opt/nemo-gym/cache/uv; Gym cache, results, source, and prefetched environments are owned by UID/GID 65532.uv,uvx, and the project interpreter.gym --help.uv.USER root.detect-secretsflagged bothuv_sha256literals asHex High Entropy String. Each is preceded by a column-0# pragma: allowlist nextline secretline; the inline same-line form is unusable here because BuildKit joinsRUNcontinuation lines into a single shell command, so a trailing#would comment out the remainder of the instruction.Tested
docker buildx build --check --build-context nemo-gym=. --target release -f docker/Dockerfile .52e5eac7d1f917b43622cbe6a2f04a0a2c091b13.docker buildx build --builder multiarch --progress=plain --build-context nemo-gym=. -f docker/Dockerfile --tag nemo-gym-rootless:pr2560 --load .nemo-gym-rootless:pr2560.docker image inspect --format {{json .Config.User}} nemo-gym-rootless:pr2560root.docker run --rm --entrypoint id nemo-gym-rootless:pr2560 -u0.docker run --rm --user 65532:65532 --env HOME=/home/nemo-runtime --env XDG_CACHE_HOME=/opt/nemo-gym/cache/xdg nemo-gym-rootless:pr2560 --helpruntime-user=65532.uv run --locked --extra dev pytest tests/unit_tests/ -quv run pre-commit run --all-filesoci-90e81a1077c4365e79891ccf:52e5eac7d1f917b43622cbe6a2f04a0a2c091b13foramd64.nvcr.io/nvidia/cuda-dl-base:26.03-cuda13.2-devel-ubuntu24.04base through the documented flattened-filesystem path; no alternate base image was selected.gvisor-dpkg-hardlink.766267172432.dkr.ecr.us-east-1.amazonaws.com/nemo-autobot/agent-sandbox@sha256:6cb5462321dda99f1eaadb273efe3a30b62806d91ec059b0f5f26b39ca189177.gym-pr-2560-rootless-52e5eac7-amd64at the same digest; pushed2026-08-15T01:55:48Z.detect-secrets-hook --baseline .github/workflows/config/.secrets.baselineover the CI change-set (git diff --name-only --diff-filter=d --merge-base origin/main)c4d47d7c3df4b547ea4c7b0f422cf5b714208cfb; previously exit 123 ondocker/Dockerfile:83and:87.caseblock with the same column-0 comment lines)PROBE arch=x86_64 sha=04f8b82f…be829.docker buildx build --check --build-context nemo-gym=. --target release -f docker/Dockerfile .