Run GrowthBook with Docker
The fastest way to run GrowthBook locally is with Docker Compose. The Compose stack below starts GrowthBook and a MongoDB instance together — no manual database wiring required.
Step-by-step walkthrough
Section titled “Step-by-step walkthrough”-
Save the compose.yaml shown in the box above to your project root. The file defines two services —
mongoandgrowthbook— and two named volumes: one for MongoDB’s data directory, one for file uploads. -
Start GrowthBook in the background by running:
docker compose up -dThe -d flag (detached mode) returns control to your terminal immediately while both containers start in the background.
-
Open your browser at
http://localhost:3000— this is the GrowthBook web UI where you create feature flags, run experiments, and manage your account. -
Your SDK will talk to
http://localhost:3100— this is the GrowthBook SDK API endpoint. Your application fetches feature flag payloads from this URL, not from port 3000. -
Stop and inspect the stack when you are done:
# Stop all containers (data is preserved in the named volumes)docker compose down
# Tail live logs for the growthbook container onlydocker compose logs -f growthbookFull compose.yaml reference
Section titled “Full compose.yaml reference”services: mongo: image: mongo:latest environment: - MONGO_INITDB_ROOT_USERNAME=root - MONGO_INITDB_ROOT_PASSWORD=password volumes: ["mongodata:/data/db"] growthbook: image: growthbook/growthbook:latest ports: ["3000:3000", "3100:3100"] depends_on: [mongo] environment: - MONGO_URL=mongodb://root:password@mongo:27017/ volumes: ["uploads:/usr/local/src/app/packages/back-end/uploads"]volumes: uploads: mongodata:Port reference
Section titled “Port reference”| Port | Service | Purpose |
|---|---|---|
| 3000 | GrowthBook web app | Admin UI — create flags, experiments, metrics |
| 3100 | GrowthBook SDK API | Your application fetches feature flags from here |
| 27017 | MongoDB (internal) | Not exposed to the host; only used by the GrowthBook container |
About MongoDB
Section titled “About MongoDB”GrowthBook stores all of its own configuration in MongoDB — feature flag definitions, experiment configs, metrics, and team settings. MongoDB does not hold your analytics event data or your user data warehouse. Your raw events stay wherever they already live (Snowflake, BigQuery, Redshift, etc.).
# Start GrowthBook and MongoDB in the background
docker compose up -d
# Stop all containers (data is preserved in the named volumes)
docker compose down
# Tail live logs for the growthbook container
docker compose logs -f growthbookTrade-offs
Section titled “Trade-offs”| Option | Benefit | Cost |
|---|---|---|
| Self-host with Docker Compose | Full control, no subscription cost | You handle ops yourself (backup, upgrades, uptime) |
| GrowthBook Cloud | No infrastructure to manage | Less control over your data and possible cost |
Common mistakes
Section titled “Common mistakes”- Running GrowthBook without persisting the MongoDB volume, so data is lost on container restart
- Not setting critical environment variables (e.g.
MONGODB_URI,JWT_SECRET) securely for production - Forgetting to back up the database before upgrading versions
💡 Real-world example
Small startups commonly start with self-hosted Docker Compose to save cost, then move to managed hosting once the team grows.