Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/backtest-kit/backtest-kit-minio-s3-docker/llms.txt

Use this file to discover all available pages before exploring further.

The full Docker deployment bundles the strategy runner inside the official tripolskypetr/backtest-kit container image alongside the MinIO and Redis infrastructure services. Rather than running the Node.js process directly on the host, the container mounts the project root as /workspace, reads its configuration from .env, and executes the compiled strategy bundle — giving you a portable, restart-safe deployment with a built-in health check. MinIO and Redis continue to run as separate containers (started via their own Compose files) and are reachable from the runner container through the host.docker.internal gateway.

The main docker-compose.yaml

The root-level docker-compose.yaml defines the strategy runner container. It is intentionally decoupled from the MinIO and Redis Compose files so that infrastructure and application lifecycle can be managed independently.
docker-compose.yaml
version: '3.8'

services:
  backtest:
    image: tripolskypetr/backtest-kit
    platform: linux/amd64
    extra_hosts:
      - "host.docker.internal:host-gateway"
    container_name: backtest-kit-minio-s3-docker
    ports:
      - "60050:60050"
    restart: unless-stopped
    volumes:
      - ./:/workspace
    working_dir: /workspace
    environment:
      - MODE
      - STRATEGY_FILE
      - SYMBOL
      - STRATEGY
      - EXCHANGE
      - FRAME
      - UI
      - TELEGRAM
      - VERBOSE
      - NO_CACHE
      - NO_FLUSH
      - ENTRY
    env_file:
      - .env
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:60050/api/v1/health/health_check"]
      interval: 30s
      timeout: 10s
      retries: 3

Key fields explained

image: tripolskypetr/backtest-kit The pre-built Docker image that ships the @backtest-kit/cli entrypoint, Node.js runtime, and all peer dependencies. Your strategy code is not baked in — it is injected at runtime via the volume mount. platform: linux/amd64 Pins the platform to linux/amd64 for consistent behaviour across Apple Silicon and other ARM hosts. Docker Desktop and most CI runners will transparently emulate this via Rosetta 2 or QEMU. extra_hosts: host.docker.internal:host-gateway Injects a /etc/hosts entry inside the container that resolves host.docker.internal to the Docker host’s gateway IP. This is what allows the strategy runner to reach MinIO on port 9000 and Redis on port 6379 using the host.docker.internal endpoints set in .env — without any custom Docker networks or service linking. ports: 60050:60050 Exposes the web UI served by @backtest-kit/ui on port 60050. Open http://localhost:60050 in a browser once the container is healthy to monitor running strategies, inspect signals, and review logs. volumes: ./:/workspace Mounts the entire project root into /workspace inside the container. Combined with working_dir: /workspace, this means the container can read your compiled ./build/index.cjs bundle, the .env file, and any supporting assets without a rebuild of the Docker image. env_file: .env Loads CC_MINIO_ENDPOINT, CC_MINIO_PORT, CC_MINIO_ACCESSKEY, CC_MINIO_SECRETKEY, CC_REDIS_HOST, CC_REDIS_PORT, CC_REDIS_USER, and CC_REDIS_PASSWORD from the project-root .env file into the container environment. environment: The explicit variable list (e.g. MODE, STRATEGY_FILE, ENTRY, UI) forwards values from the shell environment that invokes docker-compose up. This is how one-liner commands like MODE=backtest ENTRY=1 ... docker-compose up -d propagate runtime flags into the container without modifying .env. healthcheck Polls http://localhost:60050/api/v1/health/health_check every 30 seconds with a 10-second timeout and 3 retries. The container transitions from starting to healthy once the UI server is accepting requests. Docker’s restart: unless-stopped policy will restart a container that fails health checks repeatedly.

Running modes

Start the services (MinIO and Redis) first if they are not already running:
docker-compose -f docker/minio/docker-compose.yaml up -d
docker-compose -f docker/redis/docker-compose.yaml up -d
Then launch the strategy runner container in the desired mode:
1

Backtest mode

Replays historical candle data stored in MinIO.
MODE=backtest ENTRY=1 UI=1 STRATEGY_FILE=./build/index.cjs docker-compose up -d
2

Live mode

Connects to live exchange feeds and executes real orders.
MODE=live ENTRY=1 UI=1 STRATEGY_FILE=./build/index.cjs docker-compose up -d
3

Paper mode

Connects to live feeds but simulates order execution — no real trades are placed.
MODE=paper ENTRY=1 UI=1 STRATEGY_FILE=./build/index.cjs docker-compose up -d

npm script shortcuts

The package.json provides two convenience scripts that wrap the Docker Compose commands:
# Build the strategy bundle and start in backtest mode (MODE=backtest ENTRY=1 UI=1)
npm run start:docker

# Stop and remove the runner container
npm run stop:docker
npm run start:docker runs npm run build first (invoking Rollup) before calling docker-compose up -d, so you cannot accidentally start the container with a stale bundle. npm run stop:docker calls docker-compose down, which stops and removes the container but leaves the MinIO and Redis containers untouched.

Viewing logs

Stream live container output while the runner is active:
docker-compose logs -f
To follow logs for the runner container only (by name):
docker logs -f backtest-kit-minio-s3-docker
Press Ctrl+C to detach from the log stream without stopping the container.

Build step

The container reads the compiled strategy bundle from ./build/index.cjs on the host filesystem (via the volume mount). You must produce this file before starting the container:
npm run build
This runs Rollup with the project’s rollup.config and outputs ./build/index.cjs. The start:docker npm script runs the build automatically; if you invoke docker-compose up directly, make sure the build is up to date.
Always run npm run build before npm run start:docker (or before any docker-compose up command) if you have changed strategy source files. The container mounts ./build/index.cjs directly — there is no automatic rebuild inside the container image. Launching with a missing or outdated bundle will cause the runner to fail on startup.

The container reaches MinIO and Redis on the host via host.docker.internal, not via Docker service names. This is why the extra_hosts line is required in the Compose file, and why .env uses host.docker.internal as the default for CC_MINIO_ENDPOINT and CC_REDIS_HOST. If you later migrate MinIO or Redis into the same Docker Compose file as the runner and put them on a shared network, you can switch those variables to the Docker service names instead.
For production or staging deployments, create a .env file that points CC_MINIO_ENDPOINT and CC_REDIS_HOST at your managed infrastructure endpoints and replaces the default credentials. Because docker-compose.yaml loads .env automatically via env_file, no changes to the Compose file itself are needed — just update .env and restart the container with docker-compose up -d.

Build docs developers (and LLMs) love