fix(gateway): detect Docker/Podman containers for /restart service path - #25264
Closed
zccyman wants to merge 1 commit into
Closed
fix(gateway): detect Docker/Podman containers for /restart service path#25264zccyman wants to merge 1 commit into
zccyman wants to merge 1 commit into
Conversation
The /restart command only detected systemd (via INVOCATION_ID) when choosing between the detached-subprocess and service-restart approaches. In Docker/Podman containers, the gateway runs as PID 1 under tini or directly, and the detached subprocess restart fails because the container stops when PID 1 exits, killing the detached helper before it can restart anything. Fix: Detect Docker (/.dockerenv) and Podman (/run/.containerenv) alongside systemd. In container environments, use the service restart path (exit code 75) so the container restart policy (unless-stopped / on-failure) handles the restart. Closes NousResearch#25217
Collaborator
Contributor
Author
|
Thanks @alt-glitch for the catch. Closing as duplicate of #25219 — same Docker/Podman detection fix for the same file and issue #25217. Also competing with #25263. 🙏 |
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
The
/restartgateway command only detected systemd (INVOCATION_ID) when choosing between the detached-subprocess and service-restart approaches. In Docker/Podman containers, the detached subprocess approach fails because the container stops when PID 1 exits, killing the helper before it can restart anything.Problem
In a Docker container (e.g.
nousresearch/hermes-agent:lateston Unraid):/restartFix
Detect Docker (
/.dockerenv) and Podman (/run/.containerenv) alongside systemd. In container environments, use the service restart path (exit code 75) instead of the detached subprocess approach. Combined with a restart policy (unless-stoppedoron-failure), Docker/Podman handles the restart correctly.Testing
Files Changed
gateway/run.py_under_servicecheckCloses #25217