fix(docker): run as non-root user, use virtualenv (salvage #5811) - #8226
Conversation
- Add gosu for runtime privilege dropping from root to hermes user - Support HERMES_UID/HERMES_GID env vars for host mount permission matching - Switch to debian:13.4-slim base image - Use uv venv instead of pip install --break-system-packages - Pin uv and gosu multi-stage images with SHA256 digests - Set PLAYWRIGHT_BROWSERS_PATH to /opt/hermes/.playwright so build-time chromium install survives the /opt/data volume mount - Keep procps for container debugging Based on work by m0n5t3r in PR #5811. Stripped to hardening-only changes (non-root, virtualenv, slim base); matrix deps, fonts, xvfb, and entrypoint playwright download deferred to follow-up.
The slim image drops packages that may be needed at runtime. Keep the full Debian base for compatibility.
turns out git was needed after all; the docker build workflow seem to be failing in the same place, but I can't see the logs: https://github.com/NousResearch/hermes-agent/actions/runs/24305454757 |
|
Sorry to bother but how do i give docker perms back to hermes when it's running as non-root? Previously up to 0.8 it was root and dockering fine, now it's default 10000:10000 and permission denied. maybe relevant: #10096 (and Why is everything in /opt/hermes owned by default 10000:10000 when HERMES_UID/HERMES_GID are changed to 1000:1000 rather than either root or the env ids that are set?) |
|
I'll see in the morning and report back; in principle I think setting |
|
just tested, running with so it should be able to talk to the docker socket for dind purposes |
Summary
Salvage of #5811 by @m0n5t3r, stripped to hardening-only changes:
hermesuser (UID 10000). SupportsHERMES_UID/HERMES_GIDenv vars for host mount permission matching.uv venvinstead ofpip install --break-system-packages. Entrypoint activates the venv before running hermes.PLAYWRIGHT_BROWSERS_PATH=/opt/hermes/.playwrightkeeps the build-time chromium install outside the/opt/datavolume mount, avoiding the per-startup re-download from the original PR.What was stripped (deferred to follow-up)
.[matrix]install)debian:13.4full for compatibility)What was preserved from current main
procpspackage (deliberately added in [codex] Install procps in Docker image #7032)Related
Test plan