Skip to content

"Vibe-Trading: Your Personal Trading Agent"

fix(docker): persist user agent state across container rebuilds

Haozhe Wu2ba6ae2f0c10
diff --git a/Dockerfile b/Dockerfile
index c596ed346..202cc9b91 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -44,8 +44,8 @@ RUN pip install --no-cache-dir -e .
# Runtime should not run as root. Keep writable app data directories owned by
# the service user so named Docker volumes inherit usable permissions.
RUN useradd --create-home --shell /usr/sbin/nologin vibe \
- && mkdir -p agent/runs agent/sessions agent/uploads agent/.swarm/runs \
- && chown -R vibe:vibe /app
+ && mkdir -p agent/runs agent/sessions agent/uploads agent/.swarm/runs /home/vibe/.vibe-trading \
+ && chown -R vibe:vibe /app /home/vibe/.vibe-trading
USER vibe
# Default port
diff --git a/README.md b/README.md
index d3a34857d..46257b13b 100644
--- a/README.md
+++ b/README.md
@@ -446,6 +446,8 @@ Docker publishes the backend on `127.0.0.1:8899` by default and runs the app as
> [!NOTE]
> **Using Ollama with Docker:** the container reaches a host-side Ollama via `host.docker.internal`, not `localhost` (inside the container `localhost` is the container itself). `docker-compose.yml` defaults `OLLAMA_BASE_URL` to `http://host.docker.internal:11434`; export `OLLAMA_BASE_URL` (or set it in a top-level `.env`) to point elsewhere. This relies on the `host-gateway` mapping in `extra_hosts`, which requires **Docker Engine ≥ 20.10 / Compose v2** (provided automatically on Docker Desktop).
+Your data survives updates: persistent memory, the cross-session search index, user-created skills, shadow accounts, broker connector config, web sessions, backtest runs, swarm history, and uploads all live in named Docker volumes, so `git pull && docker compose up --build` keeps them. They are deleted only by `docker compose down -v`.
+
### Path B: Local install
```bash
diff --git a/docker-compose.yml b/docker-compose.yml
index 4d02e4217..a46792a29 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -19,6 +19,13 @@ services:
volumes:
- vibe-runs:/app/agent/runs
- vibe-sessions:/app/agent/sessions
+ # User-level agent state: persistent memory, cross-session search index
+ # (sessions.db), user-created skills, shadow accounts, hypothesis
+ # registry, broker connector config, agent.json. Without this volume a
+ # rebuild/recreate wipes it all (#197).
+ - vibe-home:/home/vibe/.vibe-trading
+ - vibe-swarm-runs:/app/agent/.swarm/runs
+ - vibe-uploads:/app/agent/uploads
restart: unless-stopped
frontend:
@@ -40,3 +47,6 @@ services:
volumes:
vibe-runs:
vibe-sessions:
+ vibe-home:
+ vibe-swarm-runs:
+ vibe-uploads: