mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-04-25 00:51:20 +00:00
feat: entry-level Podman support — find_docker() + rootless entrypoint (#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.
This commit is contained in:
parent
c5688e7c8b
commit
8548893d14
4 changed files with 96 additions and 11 deletions
|
|
@ -99,23 +99,41 @@ def _load_hermes_env_vars() -> dict[str, str]:
|
|||
|
||||
|
||||
def find_docker() -> Optional[str]:
|
||||
"""Locate the docker CLI binary.
|
||||
"""Locate the docker (or podman) CLI binary.
|
||||
|
||||
Checks ``shutil.which`` first (respects PATH), then probes well-known
|
||||
install locations on macOS where Docker Desktop may not be in PATH
|
||||
(e.g. when running as a gateway service via launchd).
|
||||
Resolution order:
|
||||
1. ``HERMES_DOCKER_BINARY`` env var — explicit override (e.g. ``/usr/bin/podman``)
|
||||
2. ``docker`` on PATH via ``shutil.which``
|
||||
3. ``podman`` on PATH via ``shutil.which``
|
||||
4. Well-known macOS Docker Desktop install locations
|
||||
|
||||
Returns the absolute path, or ``None`` if docker cannot be found.
|
||||
Returns the absolute path, or ``None`` if neither runtime can be found.
|
||||
"""
|
||||
global _docker_executable
|
||||
if _docker_executable is not None:
|
||||
return _docker_executable
|
||||
|
||||
# 1. Explicit override via env var (e.g. for Podman on immutable distros)
|
||||
override = os.getenv("HERMES_DOCKER_BINARY")
|
||||
if override and os.path.isfile(override) and os.access(override, os.X_OK):
|
||||
_docker_executable = override
|
||||
logger.info("Using HERMES_DOCKER_BINARY override: %s", override)
|
||||
return override
|
||||
|
||||
# 2. docker on PATH
|
||||
found = shutil.which("docker")
|
||||
if found:
|
||||
_docker_executable = found
|
||||
return found
|
||||
|
||||
# 3. podman on PATH (drop-in compatible for our use case)
|
||||
found = shutil.which("podman")
|
||||
if found:
|
||||
_docker_executable = found
|
||||
logger.info("Using podman as container runtime: %s", found)
|
||||
return found
|
||||
|
||||
# 4. Well-known macOS Docker Desktop locations
|
||||
for path in _DOCKER_SEARCH_PATHS:
|
||||
if os.path.isfile(path) and os.access(path, os.X_OK):
|
||||
_docker_executable = path
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue