From 45391d09622576cbf6dcc914a7f379d155bd2341 Mon Sep 17 00:00:00 2001 From: Yijia-Xiao Date: Thu, 24 Sep 2026 19:06:14 +0000 Subject: [PATCH] feat(docker): keep results in a host folder when TRADINGAGENTS_DATA_DIR is set (#865) - both compose services mount ${TRADINGAGENTS_DATA_DIR:-tradingagents_data}; unset keeps the named volume - README and .env.example show the setting --- .env.example | 3 +++ README.md | 2 ++ docker-compose.yml | 4 ++-- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.env.example b/.env.example index 61275aed6..0647b5115 100644 --- a/.env.example +++ b/.env.example @@ -47,6 +47,9 @@ NVIDIA_API_KEY= #TRADINGAGENTS_MAX_RISK_ROUNDS=1 #TRADINGAGENTS_CHECKPOINT_ENABLED=false +# Docker: a host folder for results, reports and the memory log (unset: the tradingagents_data volume). +#TRADINGAGENTS_DATA_DIR=./data + # Paths and alpha benchmark. Unset uses ~/.tradingagents and the regional index. #TRADINGAGENTS_RESULTS_DIR= #TRADINGAGENTS_CACHE_DIR= diff --git a/README.md b/README.md index 2fd419e7d..23bc73bc7 100644 --- a/README.md +++ b/README.md @@ -144,6 +144,8 @@ docker compose run --rm tradingagents After updating the repository, rebuild the image with `docker compose build`. +Results, reports, the memory log and the cache live in the `tradingagents_data` volume. To keep them in a folder on the host instead, create the folder and point `TRADINGAGENTS_DATA_DIR` at it, in `.env` or the shell: `mkdir -p data && TRADINGAGENTS_DATA_DIR=./data docker compose run --rm tradingagents`. + For local models with Ollama: ```bash docker compose --profile ollama run --rm tradingagents-ollama diff --git a/docker-compose.yml b/docker-compose.yml index 411c989c8..76cf0fe20 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -4,7 +4,7 @@ services: env_file: - .env volumes: - - tradingagents_data:/home/appuser/.tradingagents + - ${TRADINGAGENTS_DATA_DIR:-tradingagents_data}:/home/appuser/.tradingagents tty: true stdin_open: true @@ -23,7 +23,7 @@ services: - TRADINGAGENTS_LLM_PROVIDER=ollama - OLLAMA_BASE_URL=http://ollama:11434/v1 volumes: - - tradingagents_data:/home/appuser/.tradingagents + - ${TRADINGAGENTS_DATA_DIR:-tradingagents_data}:/home/appuser/.tradingagents depends_on: - ollama tty: true