Skip to content

/restart shuts down gateway instead of restarting in Docker containers #25218

@bird

Description

@bird

Bug

When running the Hermes gateway in a Docker container, the /restart slash command shuts down the gateway permanently instead of restarting it.

Root Cause

_handle_restart_command in gateway/run.py spawns a detached subprocess to restart the gateway when not running under systemd. In Docker, when the gateway exits, tini (PID 1) exits too, Docker stops the container, and the detached helper is killed before it can restart anything.

Fix

Detect Docker (/.dockerenv) and Podman (/run/.containerenv) containers and use the service restart path (exit code 75) instead. Combined with a restart policy (unless-stopped), Docker handles the restart.

Environment

  • nousresearch/hermes-agent:latest on Unraid
  • Host networking, tini as PID 1
  • Restart policy must be set to unless-stopped or on-failure

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Medium — degraded but workaround existsarea/dockerDocker image, Compose, packagingcomp/gatewayGateway runner, session dispatch, deliveryduplicateThis issue or pull request already existstype/bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions