Skip to content

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.

  1. Save the compose.yaml shown in the box above to your project root. The file defines two services — mongo and growthbook — and two named volumes: one for MongoDB’s data directory, one for file uploads.

  2. Start GrowthBook in the background by running:

Terminal window
docker compose up -d

The -d flag (detached mode) returns control to your terminal immediately while both containers start in the background.

  1. Open your browser at http://localhost:3000 — this is the GrowthBook web UI where you create feature flags, run experiments, and manage your account.

  2. 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.

  3. Stop and inspect the stack when you are done:

Terminal window
# Stop all containers (data is preserved in the named volumes)
docker compose down
# Tail live logs for the growthbook container only
docker compose logs -f growthbook
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:
PortServicePurpose
3000GrowthBook web appAdmin UI — create flags, experiments, metrics
3100GrowthBook SDK APIYour application fetches feature flags from here
27017MongoDB (internal)Not exposed to the host; only used by the GrowthBook container

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 growthbook
OptionBenefitCost
Self-host with Docker ComposeFull control, no subscription costYou handle ops yourself (backup, upgrades, uptime)
GrowthBook CloudNo infrastructure to manageLess control over your data and possible cost
  • 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.

Which port serves the GrowthBook web UI?
Which port do SDKs use to fetch feature flags?
What command starts GrowthBook in the background?
What does GrowthBook store in MongoDB?