The backtest-kit Redis+MongoDB Docker project is composed of three containers spread across three separate Compose files. Two infrastructure containers — MongoDB and Redis — are defined underDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/backtest-kit/backtest-kit-redis-mongo-docker/llms.txt
Use this file to discover all available pages before exploring further.
docker/ and are started independently of the application. The third container runs the tripolskypetr/backtest-kit image, mounts your project directory as /workspace, and is wired to reach the infrastructure containers via Docker’s host.docker.internal gateway. This separation lets you keep your data services running continuously while iterating on strategy code and restarting only the application container.
Directory layout
Infrastructure containers
MongoDB and Redis each live in their own Compose file underdocker/. Starting them independently means your persisted data survives application restarts and redeploys without any extra steps.
mongodb/mongodb-community-server:8.0.4-ubi8 image and exposes port 27017. Strategy data is persisted to the ./mongo_data volume so all 15 adapter collections survive container restarts. restart: always ensures MongoDB comes back up automatically after a host reboot.
Redis uses redis:7.4.1 and exposes port 6379. The password mysecurepassword is passed directly to redis-server via --requirepass, providing authentication for all incoming connections. Data is stored in ./redis_data, and like MongoDB the container is set to restart: always.
Application container
The rootdocker-compose.yaml defines the backtest-kit application container. It builds no image — it pulls tripolskypetr/backtest-kit directly and mounts your local project directory into /workspace so the container always runs whatever strategy code and compiled bundle is present on disk.
platform: linux/amd64— pins the image architecture, ensuring consistent behaviour on Apple Silicon and other ARM hosts running Docker with emulation.extra_hosts: host.docker.internal:host-gateway— injects a host entry that resolveshost.docker.internalto the Docker host’s IP, allowing the container to reach MongoDB on27017and Redis on6379without exposing those ports to the wider network.- Port
60050:60050— maps the web UI port from container to host. The UI is enabled withUI=1. - Volume
./:/workspace— mounts the entire project directory (including.env,build/, source files) into/workspace.working_diris set to/workspaceso all relative paths in the CLI resolve correctly. env_file: .env— loads your local.envfile for infrastructure connection strings. Individual environment variables (MODE,ENTRY,UI, etc.) are passed through from the host shell.- Healthcheck — polls
http://localhost:60050/api/v1/health/health_checkevery 30 seconds with a 10-second timeout and 3 retries. Docker marks the container unhealthy if the endpoint is unreachable after all retries.
Quick commands
npm run start:docker is a convenience script defined in package.json that compiles your TypeScript strategy with Rollup before launching the container, ensuring /workspace/build/index.cjs is always up-to-date. npm run stop:docker calls docker-compose down to stop and remove the application container while leaving the infrastructure containers running.
When running the application container, use
host.docker.internal instead of 127.0.0.1 in your MongoDB and Redis connection strings. From inside the container, 127.0.0.1 refers to the container’s own loopback interface — not the host. The .env.example file already uses host.docker.internal as the default: