fix: Add USER id and writable HOME fallbacks to Dockerfile ENTRYPOINT#46
Draft
matthewfeickert wants to merge 1 commit into
Draft
fix: Add USER id and writable HOME fallbacks to Dockerfile ENTRYPOINT#46matthewfeickert wants to merge 1 commit into
matthewfeickert wants to merge 1 commit into
Conversation
HTCondor's container universe runs Docker images as the execute node's
slot uid, which has no /etc/passwd entry inside the container, and with
a scrubbed environment (no USER or LOGNAME set). Python's
getpass.getuser() then raises "OSError: No username set in the
environment", aborting 'import torchvision' when torch._inductor
resolves its cache directory (/tmp/torchinductor_<username>) at import
time.
Export fallback USER and LOGNAME (the numeric uid) in the generated
entrypoint.sh so getpass.getuser() resolves from the environment without
needing the passwd database, and fall back to a writable temporary
directory when HOME is unset or unwritable (Docker sets HOME=/ for
unknown uids), protecting workloads that write to ~/.cache (torch hub,
matplotlib, fontconfig).
Apptainer images are unaffected: Apptainer injects the invoking user's
passwd entry into the container at startup ('config passwd = yes'
default in apptainer.conf), so apptainer.def needs no change.
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.
HTCondor's container universe runs Docker images as the execute node's slot
uid, which has no/etc/passwdentry inside the container, and with a scrubbed environment (noUSERorLOGNAMEset). Python'sgetpass.getuser()then raises"OSError: No username set in the environment", aborting 'import torchvision'whentorch._inductorresolves its cache directory (/tmp/torchinductor_<username>) at import time.Export fallback
USERandLOGNAME(the numeric uid) in the generated entrypoint.sh used for the Docker container images'ENTRYPOINTsogetpass.getuser()resolves from the environment without needing thepasswddatabase, and fall back to a writable temporary directory whenHOMEis unset or unwritable (Docker setsHOME=/for unknownuids), protecting workloads that write to~/.cache(torch hub, matplotlib, fontconfig).Apptainer images are unaffected: Apptainer injects the invoking user's passwd entry into the container at startup ('config passwd = yes' default in apptainer.conf), so apptainer.def needs no change.
Should go in before PR #43