![]() |
MantisBase v0.4.9
|
MantisBase provides Docker support for easy deployment and containerization. This guide covers building and running MantisBase in Docker containers.
Docker builds are currently available for linux-amd64 platform only. For ARM builds, you will need to build the project from source.
The repository includes a Dockerfile in the /docker directory. To build and run:
This builds the image and starts the container, exposing MantisBase on port 8080. Pass environment variables with -e:
By default, container restarts will clear all data. To persist data, mount volumes to the following directories:
Example with volumes:
A docker-compose.yaml file is provided for easier management:
This builds the image (using MB_VERSION build arg, default 0.4.6) and starts the container with volume mounts configured. MB_JWT_SECRET must be set outside dev mode - the server refuses to start without it. Set it and any other MB_* variables in a .env file in the same directory, or pass them when running docker compose.
The shipped image and compose file apply a few defaults worth knowing about:
You can configure MantisBase using environment variables or by mounting a configuration file. The container respects the same configuration options as the CLI. All environment variables use the MB_* prefix:
| Variable | Description | Default |
|---|---|---|
| MB_JWT_SECRET | JWT secret key for token signing. Required in production (server refuses to start without it when not in dev mode) | (dev mode fallback only) |
| MB_VERSION | Build-time only: release version to download (Dockerfile ARG) | 0.4.6 |
| MB_DISABLE_FILE_UPLOADS | Set to 1 to disable file uploads (returns 403 on upload attempts) | 0 |
| MB_DISABLE_ADMIN_ON_FIRST_BOOT | Set to 1 to skip creating admin on first boot | 0 |
| MB_DISABLE_RATE_LIMIT | Set to 1 to disable rate limiting. Only honoured in --dev mode; ignored otherwise | (enabled) |
| MB_LOG_LEVEL | Logging verbosity: trace, debug, info, warn, critical | info |
| MB_DATABASE_TYPE | MbDatabase type: sqlite3, postgresql | sqlite3 |
| MB_DATABASE_URL | MbDatabase connection string (for PostgreSQL) | — |
| MB_SKIP_ADMIN_SETUP | Set to 1 to skip the first-boot admin setup prompt | 0 |
| MB_DEFAULT_ADMIN_EMAIL | Admin email for admins --add when no positional args given | — |
| MB_DEFAULT_ADMIN_PASSWORD | Admin password for admins --add when no positional args given | — |
| MB_OAUTH_ENCRYPTION_KEY | Encryption key for OAuth client secrets. Required when OAuth is used (at least 32 chars). No longer falls back to MB_JWT_SECRET, so the token-signing key and the secret-at-rest key stay separate | — |
| MB_TRUSTED_PROXIES | Comma-separated list of reverse-proxy IPs whose X-Forwarded-For header is trusted for client-IP resolution. If unset, X-Forwarded-For is ignored and the direct peer address is used, so rate limits cannot be bypassed by spoofing the header. Set this when running behind a proxy or load balancer | — |
| MB_DISABLE_REALTIME_SSE | Set to 1 or true to disable the SSE realtime endpoint (returns 503) | 0 (enabled) |
| MB_DISABLE_REALTIME_WS | Set to 1 or true to disable the WebSocket realtime endpoint | 0 (enabled) |
| MB_CORS_ORIGINS | Comma-separated browser origins allowed for cross-origin API requests with credentials (merged with corsAllowedOrigins from app settings). Example: http://localhost:3000,https://app.example.com | — |
| MB_DISABLE_ADMIN_MUTATIONS | Set to true, 1, on, or yes to block admin account create/update/delete via the API (returns 503). Unset or any other value: edits allowed. | unset (edits allowed) |
| MB_DISABLE_CONFIG_MUTATIONS | Set to true, 1, on, or yes to block PATCH /api/v1/sys/settings/config (returns 503) | unset (edits allowed) |
MbDatabase connection is configured via command-line arguments or JSON config (e.g. --db postgresql --db_url "...").
SMTP credentials are not an environment variable. Set them in the admin dashboard at /mb/settings, with PATCH /api/v1/sys/settings/config, or from a startup script with app.settings().set("smtp", ...). See SMTP. MB_DISABLE_CONFIG_MUTATIONS blocks the dashboard and the PATCH endpoint only.
Once the container is running, access the API at: