How-To Guide
Hermes Agent Docker Compose Setup with the Official Image
Run Hermes Agent with the official Docker image, persistent /opt/data storage, supervised gateways, private dashboard access, logs, and safe updates.
Quick answer
Use the official nousresearch/hermes-agent:latest image, mount host ~/.hermes to container /opt/data, run gateway run, and add restart: unless-stopped. Port 8642 is optional for chat-only gateways; port 9119 is for the dashboard. A non-loopback dashboard now fails closed unless you configure Basic Auth, Nous OAuth, or OIDC, so use an SSH tunnel or Tailscale instead of exposing an unauthenticated admin port.
This guide runs Hermes itself in Docker as an always-on service. That is different from setting terminal.backend: docker, which keeps Hermes on the host and sandboxes only terminal, file, and code-execution tools. The official container keeps mutable agent state in /opt/data while the application tree under /opt/hermes stays immutable.
Managed cloud · API costs included · Skill library · Cancel anytime
Before you start:
- ☑Docker Engine plus the
docker composeplugin - ☑A host
~/.hermesdirectory you can back up and mount to/opt/data - ☑Provider and gateway credentials stored in
~/.hermes/.envor a secrets manager, never baked into the image - ☑A private-access plan for the dashboard: localhost plus SSH tunnel/Tailscale, or a configured authentication provider
Steps
- 1
Back up the Hermes data directory
Run
cp -a ~/.hermes ~/.hermes.backup.$(date +%Y%m%d-%H%M%S)before changing mounts, image tags, or ownership. - 2
Create the official Compose service
Use image
nousresearch/hermes-agent:latest, commandgateway run, restart policyunless-stopped, and mount~/.hermes:/opt/data. Never point two gateway containers at the same data directory. - 3
Publish only the ports you need
Publish
8642:8642only for the API/health surface and9119:9119only when enabling the dashboard withHERMES_DASHBOARD=1. Chat-only Telegram or Discord gateways do not require port 8642. - 4
Configure dashboard authentication or private access
For a non-loopback dashboard, set Basic Auth, Nous OAuth, or OIDC. Without an auth provider, the dashboard fails closed. For simple self-hosting, prefer loopback plus an SSH tunnel or Tailscale.
- 5
Start and inspect the container
Run
docker compose up -d, thendocker compose psanddocker compose logs -f hermes. The official image uses s6 supervision to restart the gateway and dashboard processes inside the container. - 6
Run health checks inside Docker
Run
docker exec hermes hermes doctor,docker exec hermes hermes gateway status, and a smalldocker exec hermes hermes chat -q "Reply with: docker-ok"smoke test. - 7
Verify persistent state
Confirm config, sessions, memories, skills, cron jobs, hooks, and logs appear under host
~/.hermes. Recreate the container once and verify that the same state returns. - 8
Verify the real delivery path
Send a test message through the configured Telegram, Discord, Slack, or webhook channel. A healthy container is not proof that channel permissions, topics, or delivery targets work.
- 9
Update without replacing state
Docker installs do not support
hermes update. Rundocker compose pullanddocker compose up -d --force-recreate, preserve/opt/data, then rerunhermes doctor, inspect gateway logs, and test one real channel.
Pro Tips
- 💡The official image maps host
~/.hermesto/opt/data; this is the persistent source of truth for config, secrets, profiles, memory, sessions, skills, cron, hooks, and logs. - 💡The application tree at
/opt/hermesis immutable in published images. Make durable changes through skills, plugins, memory, and config under/opt/data; ship core changes by updating the image. - 💡Use
docker logs -f hermesfor live output and host~/.hermes/logs/gateways/default/currentfor persistent per-profile gateway logs. - 💡One official container can supervise multiple Hermes profiles. Use separate containers only for resource, image, network, or compliance isolation.
- 💡Do not confuse full-container deployment with the Docker terminal backend. The latter creates a hardened persistent sandbox for tool calls while the Hermes process remains on the host.
- 💡Fresh July 2026 Reddit and YouTube evidence repeatedly pairs Docker demand with a usable Web UI, readable files on disk, isolation, live logs, and persistent memory. Preserve those operator-visible surfaces instead of treating the container as a black box.
- 💡If you want the agent outcome but not image updates, TLS/auth, backups, gateway uptime, and incident recovery, compare the managed FlyHermes path before adding more VPS plumbing.
- 💡For multiple profiles in one container, one supervised dashboard on 9119 covers Desktop/Web UI profile switching. If external OpenAI-compatible clients need several profiles, assign distinct API_SERVER_PORT values in each profile .env instead of duplicating the dashboard.
Troubleshooting
❌ The dashboard starts and immediately stops
✅ A dashboard bound beyond loopback requires an authentication provider. Configure Basic Auth, Nous OAuth, or OIDC, or bind to loopback and connect through SSH/Tailscale.
❌ State disappears after container recreation
✅ Verify the host directory is mounted exactly as ~/.hermes:/opt/data. Inspect the host path for config, sessions, memories, skills, cron, and logs before recreating again.
❌ Gateway is running but Telegram or Discord does not reply
✅ Check docker exec hermes hermes gateway status, current container logs, the active profile, token presence, allowed chats/channels, mention rules, and topic/thread routing. Then send an end-to-end test.
❌ Hermes works on the host but provider or MCP calls fail in Docker
✅ Run hermes config path, hermes config env-path, and hermes doctor inside the container. The host environment may have credentials or PATH entries that were never mounted or forwarded.
❌ Docker files are owned by the wrong UID
✅ Inspect ownership of host ~/.hermes and avoid arbitrary --user overrides unless the image explicitly supports them. Back up state before changing ownership.
❌ Port 8642 is open but the API does not respond
✅ The API server requires API_SERVER_ENABLED=true; non-loopback binding also requires API_SERVER_HOST=0.0.0.0 and an API_SERVER_KEY of at least eight characters. Do not expose it without a real need.
❌ The container says hermes update is unsupported
✅ Update the Docker image instead of the immutable application tree. Pull and recreate the service while keeping the host Hermes home mounted at /opt/data.
FAQ
What is the official Hermes Agent Docker image?
Use nousresearch/hermes-agent:latest unless you deliberately pin a tested release tag. The official image stores mutable state in /opt/data and keeps the installed application under /opt/hermes immutable.
Where does Hermes Agent store data in Docker?
Mount host ~/.hermes to container /opt/data. It contains .env, config.yaml, SOUL.md, sessions, memories, skills, profile home directories, cron jobs, hooks, logs, and skins.
Do I need to publish port 8642?
No for chat-only gateways. Port 8642 is for the optional OpenAI-compatible API server and health endpoint. Enable and publish it only when an external client or dashboard workflow actually needs it.
Can I expose the Hermes dashboard directly to the internet?
Do not expose it without authentication and transport security. A non-loopback dashboard now fails closed unless Basic Auth, Nous OAuth, or OIDC is configured. SSH tunneling, Tailscale, or a trusted authenticated reverse proxy is safer.
Is running Hermes in Docker the same as the Docker terminal backend?
No. Full-container deployment runs Hermes, gateways, and optional dashboard inside the official image. terminal.backend: docker runs only tool commands in a hardened persistent sandbox while Hermes stays on the host.
Should each Hermes profile use a separate container?
Usually no. The official s6-based image supervises multiple profiles in one container. Use separate containers only when you need independent resource limits, image versions, networks, or credential blast radii.
When should I use FlyHermes instead of Docker?
Choose Docker for infrastructure control and custom networking. Choose FlyHermes when you want managed uptime, browser/mobile access, connected channels, and less responsibility for updates, authentication, backups, gateway recovery, and provider operations.
Do multiple Docker profiles need multiple dashboard ports?
No. One dashboard backend can serve co-located profiles. Multiple externally exposed OpenAI-compatible API servers are separate and require distinct profile-specific API ports.
Related setup and cost guides
Hermes Agent installation guide
Verify the CLI and provider before adding the container boundary.
Hermes Docker Compose tool page
Review the official image, persistent state, and operator checklist.
Hermes Docker troubleshooting
Fix UID, volume, provider, dashboard, and gateway failures.
Hermes Agent dashboard and Web UI
Understand the self-hosted monitoring surface and its authentication boundary.
Hermes gateway troubleshooting
Diagnose channel delivery after the container itself is healthy.