Skip to content

fix(docker): preserve Docker -w workdir in main-wrapper#35485

Closed
ilonagaja509-glitch wants to merge 1 commit into
NousResearch:mainfrom
ilonagaja509-glitch:fix/35472-docker-cwd-preserved
Closed

fix(docker): preserve Docker -w workdir in main-wrapper#35485
ilonagaja509-glitch wants to merge 1 commit into
NousResearch:mainfrom
ilonagaja509-glitch:fix/35472-docker-cwd-preserved

Conversation

@ilonagaja509-glitch

Copy link
Copy Markdown
Contributor

Fixes #35472. Docker init scripts cd to /opt/data for setup but never restore the original working directory. Save pre-/opt/data cwd, then cd back before exec so container starts in Docker -w directory. Includes regression test.

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists area/docker Docker image, Compose, packaging backend/docker Docker container execution labels May 30, 2026
@benbarclay

Copy link
Copy Markdown
Collaborator

Superseded by #36259, which merged in 81dd43a and fixes #35472 with the same approach you took here — save the working directory before cd /opt/data and restore it before exec'ing the user's command, so Docker's -w flag is honored.

Thanks for the early fix @ilonagaja509-glitch — you spotted and solved this correctly. I went with #36259 because it was rebased onto current main (it uses the drop privilege-drop helper from #34837, which landed after this PR; this branch still had the older exec s6-setuidgid hermes hermes form), adds a HERMES_ORIG_CWD env override, and carries ordering-based regression tests.

Verified end-to-end before merge: on the old image docker run -w /workdir_1 … pwd returned /opt/data (the bug); after the fix it returns /workdir_1. Closing as superseded.

@benbarclay benbarclay closed this Jun 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/docker Docker image, Compose, packaging backend/docker Docker container execution P2 Medium — degraded but workaround exists type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: cwd is lost during docker init, making hermes effectively unusable

3 participants