Hermes Agent: Running with Docker Compose on Ubuntu
0 (0)

By | 12/05/2026
Click to rate this post!
[Total: 0 Average: 0]

In the previous post, FreeBSD: virtualization with bhyve – creating an Ubuntu VM, I wrote about creating an Ubuntu VM on FreeBSD – now it’s time to actually run the agents on this machine.

The general idea is to have several separate Hermes Agent instances, each with its own containers and data.

Let’s run them with Docker Compose.

Preface: general setup

Here I’ll write down a few details about how I set things up on my end – both as documentation, since the RTFM blog is also my own documentation for myself, and just as an example of how all this can be organized.

My FreeBSD NAS and Virtual Machine Data setup

The main thing I want here is to keep the data separate from the services themselves, so my main data storage is the FreeBSD/NAS.

Virtual Machine data disk

On the NAS, I have two disks for the VM – a system disk and a data disk:

root@setevoy-nas:~ # vm info hermes-pool
------------------------
Virtual Machine: hermes-pool
------------------------
  state: running (18639)
...

  virtual-disk
    number: 0
    ...
    system-path: /nas/bhyve/hermes-pool/system.img
    ... 

  virtual-disk
    number: 1
    ...
    system-path: /nas/bhyve/hermes-pool/data.img
    ...

In the VM itself, we mount the second disk at /data:

root@hermes-pool:~ # tail -1 /etc/fstab 
UUID=0f563385-6110-40e8-8efe-d78d5960f5e0 /data ext4 defaults 0 2

containerd, Docker and Hermes Agent data

In /data, we have the following directories:

root@hermes-pool:~ # tree -d -L 1 /data/
/data/
├── agents
├── containerd
├── docker

Here:

  • agents/: a directory for Hermes Agents
  • containerd/: in the /etc/containerd/config.toml file, we have root = "/data/containerd"
    • this is where containerd stores images and layers
  • docker/: in the /etc/docker/daemon.json file, we have "data-root": "/data/docker"
    • Docker uses this for container data, volumes, etc

Both systemd units for Docker and containerd require /data to be mounted – I’m getting a bit ahead of myself here, we’ll cover this below.

And then we mount /data/agents into the agent containers via Docker Compose.

Ubuntu: install Docker

Check the OS version:

root@hermes-pool:~ # cat /etc/os-release
PRETTY_NAME="Ubuntu 26.04.1 LTS"

Check that /data is mounted:

root@hermes-pool:~ # findmnt --mountpoint /data -o TARGET,SOURCE,FSTYPE
TARGET SOURCE    FSTYPE
/data  /dev/vdb1 ext4

Add the Docker repository.

The key itself:

root@hermes-pool:~ # install -m 0755 -d /etc/apt/keyrings
root@hermes-pool:~ # curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
root@hermes-pool:~ # chmod a+r /etc/apt/keyrings/docker.asc

And the /etc/apt/sources.list.d/docker.sources file:

Types: deb
URIs: https://download.docker.com/linux/ubuntu
Suites: resolute
Components: stable
Architectures: amd64
Signed-By: /etc/apt/keyrings/docker.asc

Install Docker, containerd and docker-compose:

root@hermes-pool:~ # apt update && apt -y install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

Check:

root@hermes-pool:~ # docker version
Client: Docker Engine - Community
 Version:           29.10.1
 API version:       1.57
 Go version:        go1.27.4
 Git commit:        c48360f
 Built:             Tue Nov 24 19:44:28 2026
 OS/Arch:           linux/amd64
 Context:           default

Server: Docker Engine - Community
 Engine:
  Version:          29.10.1
  API version:      1.57 (minimum version 1.40)
  Go version:       go1.27.4
  Git commit:       54cd494
  Built:            Tue Nov 24 19:44:30 2026
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          v2.4.2
  GitCommit:        b7a25261e029d68978bbf290df0a62fc819b3c51
 runc:
  Version:          1.5.3
  GitCommit:        v1.5.3-0-g46365c62
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0
root@hermes-pool:~ # docker compose version
Docker Compose version v5.8.0

Set the /data volume for Docker and containerd

Stop the services:

root@hermes-pool:~ # systemctl stop docker.socket docker.service containerd.service

Create a directory for Docker:

root@hermes-pool:~ # mkdir -p /data/docker /data/containerd /etc/docker

Edit /etc/docker/daemon.json:

{
  "data-root": "/data/docker"
}

And /etc/containerd/config.toml:

root = "/data/containerd"

Next, we need to add a check in systemd for both services to make sure /data is mounted before they start.

Use systemctl edit containerd.service and systemctl edit docker.service, and add the following to both:

[Unit]
RequiresMountsFor=/data
AssertPathIsMountPoint=/data

Start the services:

root@hermes-pool:~ # systemctl start containerd.service docker.service

Config: shared SOUL.md and the “Agent Constitution”

I’ll also write down how I organized the agent configuration.

Again – this is just my own setup and configs, but you can use it as an idea or an example.

If you don’t need this, skip straight to the Hermes Agent: Docker Compose section.

The general idea here is to have a single place where I define all the rules for the agents.

In Hermes Agent, SOUL.md defines its rules, how it communicates, etc, see Personality & SOUL.md.

And I generate a separate file with rules for each agent in my pool.

The rules are a “constitution” (I borrowed the term “constitution” itself from Volodymyr Lavrynovych, see Suzanne’s Three Laws: how I gave an agent a constitution and a personality, but rewrote the rules for myself), plus a few restrictions of my own.

Here’s how I organized all this.

On the NAS, I have a separate repository, /nas/git/hermes/setevoy-agent-context.git, which I clone to the /home/setevoy/setevoy-agent-context directory on the VM.

Its structure:

setevoy-agent-context/
├── constitution/                   # Shared rules for all agents
│   ├── interaction-contract.md     # How agents interact with the user
│   ├── epistemic-standards.md       # How agents verify claims and handle uncertainty
│   ├── authority-boundaries.md      # What agents may access or change
│   └── privacy.md                   # What agents may share or retain
├── user/                            # User context approved for sharing across agents
│   ├── identity.md                  # Shared user background
│   ├── communication.md             # Language, tone, and communication preferences
│   └── professional-context.md      # Shared professional and technical background
├── agents/                          # Agent-specific identity, role, and rules
│   ├── aice.md                      # Aice's persona, without his private profile
│   └── pice.md                      # Pice's persona and infrastructure role
├── manifests/                       # Ordered list of source files for each agent
│   ├── aice.yaml                    # Inputs for Aice's SOUL.md
│   └── pice.yaml                    # Inputs for Pice's SOUL.md
├── scripts/
│   ├── build-soul.sh                # Command to run: selects the manifest and output path
│   └── build-context.py             # Called by build-soul.sh to assemble the Markdown
├── tests/                           # Checks context assembly and the shell command
└── build/                           # Generated SOUL.md files; not tracked in Git
    ├── aice/SOUL.md
    └── pice/SOUL.md

A quick overview:

  • constitution/: common rules for all agents – what they can and cannot do (like “no write/change operations on the NAS or AWS” – although they don’t have access to either anyway)
  • user/: who I am – Arseny, how to communicate with me, etc
  • agents/: roles and rules for individual agents
  • manifests/: files defining which source files to use and in what order when building SOUL.md files
  • scripts/: scripts that collect data from constitution/, user/, agents/ and generate SOUL.md
  • build/: the output of the scripts from scripts/

Then, whenever I make changes or create a new agent, I run /home/setevoy/setevoy-agent-context/scripts/build-soul.sh, which uses build-context.py to generate build/<agent_name>/SOUL.md.

And then I manually copy this file (I deliberately chose not to automate this) to /data/agents/<agent_name>/data/SOUL.md.

Hermes Agent: Docker Compose setup

And finally, the main part.

Let’s create a Docker Compose setup with three containers – Hermes Gateway, Hermes Dashboard and Hermes WebUI.

The working directory is /data/agents.

I currently have just one agent there, Pice (Platform Ice).

Let’s add Tice (Test Ice) as an example.

Create the agent’s directory:

root@hermes-pool:~ # mkdir -p /data/agents/tice

Create its working directories:

root@hermes-pool:~ # mkdir -p /data/agents/tice/data /data/agents/tice/workspace

Hermes Agent: Docker Compose file

The /data/agents/tice/.env file – here we set the parameters for running the containers, since different agents use different ports:

HERMES_VERSION=v0.23.6
HERMES_WEBUI_IMAGE=ghcr.io/nesquena/hermes-webui:0.52.763
GATEWAY_API_PORT=8643
WEBUI_PORT=8788
DASHBOARD_PORT=9120

Here:

  • HERMES_VERSION: get the latest release here – hermes-agent/releases
  • HERMES_WEBUI_IMAGE: get it from the hermes-webui/releases page
  • GATEWAY_API_PORT: so the Dashboard can connect to the Gateway
  • WEBUI_PORT and DASHBOARD_PORT: set a separate port for each agent

An example Docker Compose file for Hermes Agent itself is here – docker-compose.yml.

An example Docker Compose file for WebUI is here – docker-compose.three-container.yml.

Create the /data/agents/tice/compose.yaml file:

name: tice

services:
  gateway:
    image: "nousresearch/hermes-agent:${HERMES_VERSION:?Set HERMES_VERSION in .env}"
    command: ["gateway", "run"]
    network_mode: host
    restart: unless-stopped
    environment:
      HERMES_UID: "10000"
      HERMES_GID: "10000"
      API_SERVER_ENABLED: "true"
      API_SERVER_HOST: "127.0.0.1"
      API_SERVER_PORT: "${GATEWAY_API_PORT:?Set GATEWAY_API_PORT in .env}"
    volumes:
      - ./data:/opt/data
      - ./workspace:/workspace
      - hermes-agent-src:/opt/hermes
    logging:
      driver: journald

  webui:
    image: "${HERMES_WEBUI_IMAGE:?Set HERMES_WEBUI_IMAGE in .env}"
    restart: unless-stopped
    depends_on:
      - gateway
    ports:
      - "0.0.0.0:${WEBUI_PORT:?Set WEBUI_PORT in .env}:8787"
    environment:
      WANTED_UID: "10000"
      WANTED_GID: "10000"
      HERMES_WEBUI_HOST: "0.0.0.0"
      HERMES_WEBUI_STATE_DIR: /home/hermeswebui/.hermes/webui
    volumes:
      - ./data:/home/hermeswebui/.hermes
      - ./workspace:/workspace
      - hermes-agent-src:/home/hermeswebui/.hermes/hermes-agent:ro
    logging:
      driver: journald

  dashboard:
    image: "nousresearch/hermes-agent:${HERMES_VERSION:?Set HERMES_VERSION in .env}"
    command: ["dashboard", "--host", "0.0.0.0", "--port", "${DASHBOARD_PORT:?Set DASHBOARD_PORT in .env}", "--no-open"]
    network_mode: host
    restart: unless-stopped
    depends_on:
      - gateway
    environment:
      HERMES_UID: "10000"
      HERMES_GID: "10000"
      GATEWAY_HEALTH_URL: "http://127.0.0.1:${GATEWAY_API_PORT:?Set GATEWAY_API_PORT in .env}"
    volumes:
      - ./data:/opt/data
      - ./workspace:/workspace
    logging:
      driver: journald

volumes:
  hermes-agent-src:
    name: "tice-hermes-agent-src-${HERMES_VERSION:?Set HERMES_VERSION in .env}"

A few interesting things here:

  • we define three containers – Hermes Gateway, Hermes Dashboard and Hermes WebUI
  • UID and GID – the Hermes defaults, “10000” – so the files on the host (VM) are owned by this user
  • logging.driver: write logs to journald on the host (Hermes itself also writes its own logs to /data/agents/<agent_name>/data/logs/)
  • volumes.hermes-agent-src: create a Docker Volume on the host, see below

Hermes Agent: Docker Volumes

And a bit more about the volumes.

Taking the gateway container as an example, here we have:

...
    volumes:
      - ./data:/opt/data
      - ./workspace:/workspace
      - hermes-agent-src:/opt/hermes
...

First, we define ./data:/opt/data – this mounts the /data/agents/tice/data/ directory from the host (we created it empty above) into the container as /opt/data – this is where Hermes Agent keeps its own data, such as its SQLite database, the SOUL.md file, etc. Hermes will create its data when we start and configure it. See the Dockerfile and HERMES_HOME.

Second, we define ./workspace:/workspace – this is mostly for WebUI, where it will store the user’s working data (files, artifacts), but we also mount it into the Gateway container so that Telegram (or whatever you use) can access these files too. See the example in its docker-compose.three-container.yml#L160.

And the third, more interesting and important one – hermes-agent-src: when we start the Docker Compose project, it creates an empty volume, and when Docker mounts it into the gateway container, Docker copies the existing contents of /opt/hermes from the image into the volume (the Hermes Agent code itself), see Dockerfile#L181.

Why do we need a shared volume? So that the WebUI container has the same Hermes Agent code as the Gateway, alongside the WebUI code itself – we define this in webui => volumes => hermes-agent-src:/home/hermeswebui/.hermes/hermes-agent:ro.

With each Hermes Agent version upgrade (changing the Docker Tag in .env and restarting the service, see the systemd section below), Docker Compose will create a new Docker Volume with the new code and mount it into the gateway and webui containers.

Prepare the SOUL.md file (this is specific to my setup):

root@hermes-pool:/home/setevoy/setevoy-agent-context # sh scripts/build-soul.sh tice
built: /home/setevoy/setevoy-agent-context/build/tice/SOUL.md

root@hermes-pool:/home/setevoy/setevoy-agent-context # cp build/tice/SOUL.md /data/agents/tice/data/SOUL.md

Hermes Agent: starting Docker Compose

First, set a username and password for the dahsboard:

# cd /data/agents/tice/
# docker compose run --rm --no-deps dashboard dashboard password --username setevoy
[+] run 3/3
 ✔ Volume tice-hermes-agent-src-v0.23.6      Created                                                                                                                                                                                                               0.0s
...
  Password: 
  Confirm password: 
✓ Dashboard sign-in set for user 'setevoy' (config.yaml, dashboard.basic_auth: a password hash, never the password).
  Created a signing secret (dashboard.basic_auth.secret) so sign-ins survive a restart.
...

Next, run gateway setup to configure Hermes Agent itself:

# docker compose run --rm --no-deps gateway setup

Go through the standard Full setup – I won’t cover it here, maybe in a separate post:

Hermes Agent: запуск з Docker Compose на Ubuntu

Now start the entire stack:

# docker compose up

To check that it works, go to http://192.168.0.57:9120:

Hermes Agent: запуск з Docker Compose на Ubuntu

For WebUI authentication, see its documentation.

Check the chat:

Hermes Agent: запуск з Docker Compose на Ubuntu

Manage the Hermes Docker Service with systemd

And to make life a bit easier, add a systemd unit, the /etc/systemd/system/[email protected] file:

[Unit]
Description=Hermes Compose project (%i)
Requires=docker.service
After=docker.service
RequiresMountsFor=/data/agents/%i

[Service]
Type=oneshot
RemainAfterExit=yes
WorkingDirectory=/data/agents/%i
ExecStart=/usr/bin/docker compose up -d
ExecStop=/usr/bin/docker compose down

[Install]
WantedBy=multi-user.target

Enable autostart for tice (WorkingDirectory=/data/agents/tice):

root@hermes-pool:~ # systemctl daemon-reload
root@hermes-pool:~ # systemctl enable --now hermes@tice
Created symlink '/etc/systemd/system/multi-user.target.wants/[email protected]' → '/etc/systemd/system/[email protected]'.

Check:

root@hermes-pool:~ # systemctl status hermes@tice
● [email protected] - Hermes Compose project (tice)
     Loaded: loaded (/etc/systemd/system/[email protected]; enabled; preset: enabled)
     Active: active (exited) since Sat 2026-12-05 14:20:11 UTC; 1min 27s ago
 Invocation: 96f236cb4cfb49fab70f58d7b4e3aea3
...

The containers:

root@hermes-pool:~ # docker ps
CONTAINER ID   IMAGE                                    COMMAND                  CREATED          STATUS                   PORTS                    NAMES
b0a1bc1f22d0   nousresearch/hermes-agent:v0.23.6        "/opt/hermes/docker/…"   10 minutes ago   Up 2 minutes                                      tice-dashboard-1
f4ab544c51f5   nousresearch/hermes-agent:v0.23.6        "/opt/hermes/docker/…"   10 minutes ago   Up 2 minutes                                      tice-gateway-1
008e1e942f36   ghcr.io/nesquena/hermes-webui:0.52.763   "/hermeswebui_init.b…"   25 minutes ago   Up 2 minutes (healthy)   0.0.0.0:8788->8787/tcp   tice-webui-1

Service logs:

root@hermes-pool:~ # journalctl -u hermes@tice -n 50 -f
Dec 05 14:20:09 hermes-pool systemd[1]: Starting [email protected] - Hermes Compose project (tice)...
Dec 05 14:20:09 hermes-pool docker[722402]:  Container tice-gateway-1 Starting
Dec 05 14:20:10 hermes-pool docker[722402]:  Container tice-gateway-1 Started
Dec 05 14:20:10 hermes-pool docker[722402]:  Container tice-webui-1 Starting
Dec 05 14:20:10 hermes-pool docker[722402]:  Container tice-dashboard-1 Starting
Dec 05 14:20:10 hermes-pool docker[722402]:  Container tice-webui-1 Started
Dec 05 14:20:10 hermes-pool docker[722402]:  Container tice-dashboard-1 Started
Dec 05 14:20:11 hermes-pool systemd[1]: Finished [email protected] - Hermes Compose project (tice).

Logs from an individual container:

root@hermes-pool:~ # journalctl CONTAINER_NAME=tice-gateway-1 -n 20 -f
...
Dec 05 14:20:35 hermes-pool f4ab544c51f5[26094]: ┌─────────────────────────────────────────────────────────┐
Dec 05 14:20:35 hermes-pool f4ab544c51f5[26094]: │           ☤ Hermes Gateway Starting...                 │
Dec 05 14:20:35 hermes-pool f4ab544c51f5[26094]: ├─────────────────────────────────────────────────────────┤
Dec 05 14:20:35 hermes-pool f4ab544c51f5[26094]: │  Messaging platforms + cron scheduler                    │
Dec 05 14:20:35 hermes-pool f4ab544c51f5[26094]: │  Press Ctrl+C to stop                                   │
Dec 05 14:20:35 hermes-pool f4ab544c51f5[26094]: └─────────────────────────────────────────────────────────┘
...

Or directly from the logs directory:

root@hermes-pool:~ # tail -n 20 -F /data/agents/tice/data/logs/gateway.log
....
2026-12-05 14:20:58,859 INFO gateway.run: ✓ api_server connected
2026-12-05 14:20:58,860 INFO gateway.run: ✓ telegram connected

Done.

Loading