Add documentation for running as unprivileged user #11617
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.
Hey! I took the initiative of writing a bit of docs for the things I had to figure out myself. Plus, it was asked in #10047.
I think the docs could use a paragraph explaining the case of using cache mounts. But I've encountered the limits of my understanding of docker and uv.
Here's the problem I found when trying to document it:
--mount=type=cache
leaves a root-owned directory after theRUN
instruction has run; even when using theuid=...
/gid=...
options. I don't know if this is intended behavior or a bug.This makes it so that you need to either (1)
rmdir
it before allowing the command inCMD ["uv", "run", "foobar.py"]
to run, or (2) resetUV_CACHE_DIR
to point to somewhere else.Regardless of 1 or 2, the cache at "build" time becomes useless for the program at run time, and I don't know how important that is.