fix(docker): make stage2-hook rootless-safe without regressing ownership bootstrap - #58203
Open
fisker086 wants to merge 1 commit into
Open
fix(docker): make stage2-hook rootless-safe without regressing ownership bootstrap#58203fisker086 wants to merge 1 commit into
fisker086 wants to merge 1 commit into
Conversation
tonydwb
reviewed
Jul 4, 2026
tonydwb
left a comment
There was a problem hiding this comment.
Code Review Summary
Verdict: Comment (token read-only; formal approval not possible)
Makes docker/stage2-hook.sh rootless-Podman/K8s safe without regressing normal Docker-as-root bootstrap. mkdir failure is now non-fatal, root-only operations guarded with if [ "$(id -u)" = 0 ], preserving prior fixes for HERMES_HOME bootstrap and ownership reconciliation.
- Well-scoped: only rootless safety, no removal of existing functionality
- Good backward compatibility for majority Docker users
- Detailed analysis of what changed vs. what was preserved
Reviewed by Hermes Agent
Contributor
|
Thanks for preserving the root bootstrap and targeted ownership behavior while handling the failed-mkdir path. Problems
Suggested changes
Automated hermes-sweeper review. |
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.
Summary
Make
docker/stage2-hook.shtolerate rootless Podman and K8srunAsUserstartupwithout regressing the normal Docker-as-root bootstrap path.
Under
set -eu, a failingmkdir -p "$HERMES_HOME"currently aborts the entirecont-init hook in environments where the data volume must be pre-created on the
host (rootless Podman). This change treats that mkdir failure as non-fatal while
preserving the #18482 / #18488 behavior for real root starts.
Root-only operations (UID/GID remap, docker socket group setup, targeted chown)
are guarded with
if [ "$(id -u)" = 0 ]instead of removing them outright, so#19788 / #19795 ownership reconciliation continues to work for the majority of
non-rootless Docker users.
What changed
mkdir -p "$HERMES_HOME"as root;failure logs a warning and continues instead of exiting under
set -eu.usermod -uisnon-fatal when it fails under rootless mapped-root.
chown_hermes_tree(), profiles/cron resets, andthe top-level state-file allowlist are unchanged in logic; they run only as root.
chmodstill runs when not root;chownis root-only.What this PR does NOT change
SPARK_*,bootstrap_spark_runtime.py,sync_nexus_hermes_config.py, etc.).maindoes not contain bash array syntax in this file; thisPR is scoped to rootless / non-root startup safety only.
Related
diff removed mkdir/chown and added private-distro code).
Fixes #
Type of Change
How to Test
Normal Docker (regression check)