Repository navigation
build(docker): install uv and its managed Python outside /root - #4260
Merged
Merged
Conversation
Install uv into /usr/local/bin and uv's managed Python into /opt/uv/python so an unprivileged runtime UID (for example 65532) can run the image's toolchain. /root is not traversable by other users, and the project venv's python is a symlink into the managed-Python directory, so both were unusable for a non-root caller. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Signed-off-by: oliver könig <[email protected]>
|
Auto-sync is disabled for ready for review pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
Contributor
Author
|
/ok to test ad38e2b |
Contributor
Author
|
/review |
svcnvidia-nemo-ci
previously approved these changes
Sep 24, 2026
svcnvidia-nemo-ci
left a comment
Contributor
There was a problem hiding this comment.
No blocking issues found. Installing uv in /usr/local/bin and its managed Python under /opt/uv/python removes the /root traversal dependency while preserving existing build-stage discovery and cache behavior.
Review generated by codex
Create the nemo-runtime user (65532) and its home, pre-create the writable runtime paths a non-root caller needs, and hand it the three prebuilt environment roots (/opt/nemo-rl, the project venv, the Ray actor venvs) so it can create entries there. Only the directories change owner, so no venv file is copied into the layer. A build-time probe runs as that UID; the image stays root by default. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Signed-off-by: oliver könig <[email protected]>
Contributor
Author
|
/ok to test 1f112c0 |
Contributor
Author
|
/ok to test d149d39 |
Contributor
Author
|
/ok to test d8b65a2 |
kajalj22
self-requested a review
September 28, 2026 17:32
kajalj22
approved these changes
Sep 28, 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.
Background / motivation
USER, and a root-default image like this one runs as UID/GID 65532./root(/root/.local/bin,/root/.local/share/uv/python), which other users cannot traverse, and/opt/nemo_rl_venv/bin/pythonsymlinks into it./opt/nemo-rl,/opt/nemo_rl_venv,/opt/ray_venvs) or missing under a root-owned parent (/opt/gym_venvs, the cache and source paths below).PermissionError: … '/opt/nemo-rl/datasets'.What changed
docker/Dockerfile:/usr/local/binand its managed Python toUV_PYTHON_INSTALL_DIR=/opt/uv/python, and drop the unused/root/.local/binPATH entry;release, create thenemo-runtimeuser (UID/GID 65532, home/home/nemo-runtime), the same convention the Automodel and Gym images use;USER root.Details
/usr/local/binis already on the default PATH, so every later build step still findsuv.ENV UV_PYTHON_INSTALL_DIRpersists, so root callers still find the managed Python.Runtime paths owned by the new user:
/home/nemo-runtime${NEMO_GYM_VENV_DIR}(/opt/gym_venvs)/opt/nemo_rl_cache/uv,/opt/nemo_rl_python,/opt/nemo-rl-source,/nemo_runnemo-rlruntime profile points at; a non-root process cannot create them under/or/opt/opt/nemo-rl,${UV_PROJECT_ENVIRONMENT},${NEMO_RL_VENV_DIR}chown, notchown -R), so the runtime user can create entries such as thedatasetslink or a new actor venvOnly directories change owner. The venvs are hardlinked against the uv cache in the
hermeticlayer, so a recursivechownhere would copy every venv file into this layer. Their existing contents stay root-owned and readable.The image still runs as root by default; nothing changes for root callers. The uv cache stays in
/root/.cache/uv, so the CI cache-seeding paths incicd-main.ymlkeep working.Tested
The PR image (
ad38e2bd9,Build H100 container) on the NeMo CI GCP H100 cluster. The Pod ran this commit's twoRUNbodies verbatim as root, then dropped to UID/GID 65532 with no capabilities andno_new_privs. It then executed the NeMo CI launcher's productionnemo-rlrank command.uv --version, venvpython --version,test -won every path above): ok.nemo-rlprofile bootstrap: all ten writable paths plus the/opt/nemo-rl/datasetsdirectory link: ok. Before this change it failed withPermissionError.import nemo_rlfrom/opt/nemo_rl_venv: ok.python -m torch.distributed.runNCCL all-reduce:rank 0 uid 65532 allreduce 3.0,rank 1 uid 65532 allreduce 3.0.tests/unit/L0_Unit_Tests_Algorithms.shstops atuv runrebuilding the editablenemo-rloffline (setuptoolsnot in the empty caller-selectedUV_CACHE_DIR). A root control with the same environment fails identically, so that is not a UID effect and is outside this PR.CI:L0container build for this commit.🤖 Generated with Claude Code