Docker images of MongoDB Compass Web
50K+
A web-based port of MongoDB Compass — the official MongoDB GUI — served as a self-hosted web application.
docker run -p 8080:8080 \
-e CW_MONGO_URI="mongodb://localhost:27017" \
haohanyang/compass-web
Then open http://localhost:8080 in your browser.
services:
compass:
image: haohanyang/compass-web
ports:
- "8080:8080"
environment:
- CW_MONGO_URI=mongodb://localhost:27017
- CW_ENABLE_SHELL=true
- CW_MASTER_PASSWORD=changeme
All options can be set via environment variables using the CW_ prefix (e.g., --mongo-uri → CW_MONGO_URI).
| Environment Variable | Default | Description |
|---|---|---|
CW_MONGO_URI | — | MongoDB connection string(s). Separate multiple URIs with spaces. |
CW_PORT | 8080 | Port the server listens on. |
CW_HOST | localhost | Host the server binds to. Use 0.0.0.0 to accept external connections. |
CW_BASE_ROUTE | — | URL prefix for all routes, e.g. /compass. Useful when running behind a reverse proxy at a sub-path. |
CW_APP_NAME | Compass Web | Application name shown in the UI. |
| Environment Variable | Default | Description |
|---|---|---|
CW_ENABLE_EDIT_CONNECTIONS | false | Allow users to add, edit, and delete connections from the UI. |
CW_MASTER_PASSWORD | — | Password used to encrypt stored connection credentials. Required when persisting connections with sensitive credentials. |
CW_ENABLE_SHELL | false | Enable the integrated MongoDB Shell. |
| Environment Variable | Default | Description |
|---|---|---|
CW_BASIC_AUTH_USERNAME | — | Username for HTTP Basic Authentication. Both username and password must be set to enable auth. |
CW_BASIC_AUTH_PASSWORD | — | Password for HTTP Basic Authentication. |
| Environment Variable | Default | Description |
|---|---|---|
CW_ENABLE_GEN_AI | false | Enable AI-assisted query and aggregation generation. |
CW_OPENAI_API_KEY | — | OpenAI API key. Required when GenAI is enabled. |
CW_OPENAI_MODEL | gpt-4o-mini | OpenAI model to use for query generation. |
CW_ENABLE_GEN_AI_SAMPLE_DOCUMENTS | false | Send sample documents to the AI to improve query accuracy. |
CW_QUERY_SYSTEM_PROMPT | (built-in) | Override the system prompt used for query generation. |
CW_AGGREGATION_SYSTEM_PROMPT | (built-in) | Override the system prompt used for aggregation generation. |
docker run -p 8080:8080 \
-e CW_HOST=0.0.0.0 \
-e CW_BASE_ROUTE=/compass \
-e CW_MONGO_URI="mongodb://mongo:27017" \
haohanyang/compass-web
docker run -p 8080:8080 \
-e CW_MONGO_URI="mongodb://mongo:27017" \
-e CW_BASIC_AUTH_USERNAME=admin \
-e CW_BASIC_AUTH_PASSWORD=secret \
haohanyang/compass-web
docker run -p 8080:8080 \
-e CW_MONGO_URI="mongodb://mongo:27017" \
-e CW_ENABLE_GEN_AI=true \
-e CW_OPENAI_API_KEY=sk-... \
haohanyang/compass-web
Content type
Image
Digest
sha256:f4f8fe4e2…
Size
124.2 MB
Last updated
23 days ago
docker pull haohanyang/compass-web