Skip to content

feat: add HERMES_DOCKER_BINARY env var override for docker backend#3996

Closed
alanjds wants to merge 2 commits into
NousResearch:mainfrom
alanjds:feat/hermes-docker-binary-env-override
Closed

feat: add HERMES_DOCKER_BINARY env var override for docker backend#3996
alanjds wants to merge 2 commits into
NousResearch:mainfrom
alanjds:feat/hermes-docker-binary-env-override

Conversation

@alanjds

@alanjds alanjds commented Mar 30, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Adds a HERMES_DOCKER_BINARY environment variable that lets users specify an alternative container runtime binary without touching PATH or creating symlinks.

Use case: Users running Podman instead of Docker (e.g. on immutable Linux distros like Bazzite, or inside a Distrobox container where Docker's storage driver is broken) can now set:

HERMES_DOCKER_BINARY=/usr/local/bin/podman

in ~/.hermes/.env and the terminal backend will use it transparently.

How it works

find_docker() in tools/environments/docker.py now checks HERMES_DOCKER_BINARY first, before any PATH resolution via shutil.which(). If the value is set but the path is invalid or not executable, it falls through silently to the existing logic — no behavior change for users who don't set it.

Tested on

  • Host OS: Bazzite Linux (immutable, rpm-ostree based)
  • Agent runtime: Ubuntu Distrobox container
  • Alternative runtime: Podman /usr/local/bin/podman
  • Docker's storage driver (fuse-overlayfs and overlay2) both fail on this setup; Podman works with no issues so far using this override.

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 🔒 Security fix
  • 📝 Documentation update
  • ✅ Tests (adding or improving test coverage)
  • ♻️ Refactor (no behavior change)
  • 🎯 New skill (bundled or hub)

Changes Made

  • tools/environments/docker.py: add HERMES_DOCKER_BINARY env var check at the top of find_docker()

How to Test

  1. Set HERMES_DOCKER_BINARY=/usr/local/bin/podman in ~/.hermes/.env
  2. Set TERMINAL_ENV=docker and start a Hermes session
  3. Run a terminal command -- it should execute inside a Podman container instead of Docker
  4. To verify the fallthrough: set HERMES_DOCKER_BINARY=/nonexistent/path -- Hermes should fall back to resolving docker from PATH as normal

Checklist

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits (fix(scope):, feat(scope):, etc.)
  • I searched for existing PRs to make sure this isn't a duplicate
  • My PR contains only changes related to this fix/feature (no unrelated commits)
  • I've run pytest tests/ -q and all tests pass
  • I've added tests for my changes (required for bug fixes, strongly encouraged for features)
  • I've tested on my platform: Bazzite Linux w/ Distrobox Ubuntu 24.04

Documentation & Housekeeping

  • I've updated relevant documentation (README, docs/, docstrings) — or N/A
  • I've updated cli-config.yaml.example if I added/changed config keys — or N/A
  • I've updated CONTRIBUTING.md or AGENTS.md if I changed architecture or workflows — or N/A
  • I've considered cross-platform impact (Windows, macOS) per the compatibility guide — or N/A
  • I've updated tool descriptions/schemas if I changed tool behavior — or N/A

alanjds added 2 commits March 30, 2026 13:35
Allows users to specify an alternative container runtime binary
(e.g. Podman) via HERMES_DOCKER_BINARY=/usr/local/bin/podman in
~/.hermes/.env, without touching PATH or symlinking binaries.

The override is checked first in find_docker(), before shutil.which()
resolution. Falls through silently if the path is invalid or not
executable, preserving existing behavior.
Also document HERMES_DOCKER_BINARY in .env.example under
the terminal configuration section.
teknium1 added a commit that referenced this pull request Apr 15, 2026
- find_docker() now checks HERMES_DOCKER_BINARY env var first, then
  docker on PATH, then podman on PATH, then macOS known locations
- Entrypoint respects HERMES_HOME env var (was hardcoded to /opt/data)
- Entrypoint uses groupmod -o to tolerate non-unique GIDs (fixes macOS
  GID 20 conflict with Debian's dialout group)
- Entrypoint makes chown best-effort so rootless Podman continues
  instead of failing with 'Operation not permitted'
- 5 new tests covering env var override, podman fallback, precedence

Based on work by alanjds (PR #3996) and malaiwah (PR #8115).
Closes #4084.
teknium1 added a commit that referenced this pull request Apr 15, 2026
#10066)

- find_docker() now checks HERMES_DOCKER_BINARY env var first, then
  docker on PATH, then podman on PATH, then macOS known locations
- Entrypoint respects HERMES_HOME env var (was hardcoded to /opt/data)
- Entrypoint uses groupmod -o to tolerate non-unique GIDs (fixes macOS
  GID 20 conflict with Debian's dialout group)
- Entrypoint makes chown best-effort so rootless Podman continues
  instead of failing with 'Operation not permitted'
- 5 new tests covering env var override, podman fallback, precedence

Based on work by alanjds (PR #3996) and malaiwah (PR #8115).
Closes #4084.
@teknium1

Copy link
Copy Markdown
Contributor

Merged via PR #10066 which incorporates your HERMES_DOCKER_BINARY env var approach along with entrypoint fixes for rootless Podman. Your work is credited in the commit message. Thanks @alanjds!

@teknium1 teknium1 closed this Apr 15, 2026
ulasbilgen pushed a commit to ulasbilgen/hermes-adhd-agent that referenced this pull request May 1, 2026
NousResearch#10066)

- find_docker() now checks HERMES_DOCKER_BINARY env var first, then
  docker on PATH, then podman on PATH, then macOS known locations
- Entrypoint respects HERMES_HOME env var (was hardcoded to /opt/data)
- Entrypoint uses groupmod -o to tolerate non-unique GIDs (fixes macOS
  GID 20 conflict with Debian's dialout group)
- Entrypoint makes chown best-effort so rootless Podman continues
  instead of failing with 'Operation not permitted'
- 5 new tests covering env var override, podman fallback, precedence

Based on work by alanjds (PR NousResearch#3996) and malaiwah (PR NousResearch#8115).
Closes NousResearch#4084.
aj-nt pushed a commit to aj-nt/hermes-agent that referenced this pull request May 1, 2026
NousResearch#10066)

- find_docker() now checks HERMES_DOCKER_BINARY env var first, then
  docker on PATH, then podman on PATH, then macOS known locations
- Entrypoint respects HERMES_HOME env var (was hardcoded to /opt/data)
- Entrypoint uses groupmod -o to tolerate non-unique GIDs (fixes macOS
  GID 20 conflict with Debian's dialout group)
- Entrypoint makes chown best-effort so rootless Podman continues
  instead of failing with 'Operation not permitted'
- 5 new tests covering env var override, podman fallback, precedence

Based on work by alanjds (PR NousResearch#3996) and malaiwah (PR NousResearch#8115).
Closes NousResearch#4084.
02356abc pushed a commit to 02356abc/hermes-agent that referenced this pull request May 14, 2026
NousResearch#10066)

- find_docker() now checks HERMES_DOCKER_BINARY env var first, then
  docker on PATH, then podman on PATH, then macOS known locations
- Entrypoint respects HERMES_HOME env var (was hardcoded to /opt/data)
- Entrypoint uses groupmod -o to tolerate non-unique GIDs (fixes macOS
  GID 20 conflict with Debian's dialout group)
- Entrypoint makes chown best-effort so rootless Podman continues
  instead of failing with 'Operation not permitted'
- 5 new tests covering env var override, podman fallback, precedence

Based on work by alanjds (PR NousResearch#3996) and malaiwah (PR NousResearch#8115).
Closes NousResearch#4084.
gweeteve pushed a commit to gweeteve/hermes-agent that referenced this pull request Jun 2, 2026
NousResearch#10066)

- find_docker() now checks HERMES_DOCKER_BINARY env var first, then
  docker on PATH, then podman on PATH, then macOS known locations
- Entrypoint respects HERMES_HOME env var (was hardcoded to /opt/data)
- Entrypoint uses groupmod -o to tolerate non-unique GIDs (fixes macOS
  GID 20 conflict with Debian's dialout group)
- Entrypoint makes chown best-effort so rootless Podman continues
  instead of failing with 'Operation not permitted'
- 5 new tests covering env var override, podman fallback, precedence

Based on work by alanjds (PR NousResearch#3996) and malaiwah (PR NousResearch#8115).
Closes NousResearch#4084.
Egavasyug pushed a commit to Egavasyug/hermes-agent that referenced this pull request Jun 10, 2026
NousResearch#10066)

- find_docker() now checks HERMES_DOCKER_BINARY env var first, then
  docker on PATH, then podman on PATH, then macOS known locations
- Entrypoint respects HERMES_HOME env var (was hardcoded to /opt/data)
- Entrypoint uses groupmod -o to tolerate non-unique GIDs (fixes macOS
  GID 20 conflict with Debian's dialout group)
- Entrypoint makes chown best-effort so rootless Podman continues
  instead of failing with 'Operation not permitted'
- 5 new tests covering env var override, podman fallback, precedence

Based on work by alanjds (PR NousResearch#3996) and malaiwah (PR NousResearch#8115).
Closes NousResearch#4084.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants