Repository navigation
Running IBM MCP Context Forge (MCP Gateway) on Dokploy with SQLite #7517
Replies: 2 comments
|
Great guide on container permissions for Dokploy! The non-root UID A couple of additional operational patterns that have proven effective when running SQLite under MCP gateway workloads before migrating to PostgreSQL: 1. Eliminating
|
|
Hey, @red1xe, thanks for the guide, nice work there! Considering opening a PR with the fix! |
Uh oh!
There was an error while loading. Please reload this page.
Running IBM MCP Context Forge (MCP Gateway) on Dokploy with SQLite
Fixing
sqlite3.OperationalError: unable to open database fileThe symptom
You deploy
ghcr.io/ibm/mcp-context-forgeon Dokploy (or any Docker Compose setup) with a named volume for SQLite, and the container gets stuck in the DB readiness check:Your
DATABASE_URLis probably fine.sqlite:////data/mcp.db(4 slashes) is the correct absolute path.The cause
The image runs as a non-root user (
uid=10001,gid=10001). You can check this yourself:docker run --rm --entrypoint id ghcr.io/ibm/mcp-context-forge:latest # uid=10001(app) gid=10001(app) groups=10001(app)When Docker creates a named volume and mounts it at
/data(a path that doesn't exist in the image), the mount point is owned by root. The app user can't createmcp.dbthere. SQLite also needs write access to the directory, not just the file, for its journal/WAL files.The fix
1. Add an init container that sets ownership on every deploy
Put the secrets in Dokploy's Environment tab, not in the compose file.
2. If the volume already exists with wrong ownership, fix it once by hand
Dokploy prefixes volume names with the project/app name, so find the real name first:
Then chown it and restart:
3. Verify
You should see
/dataowned by10001 10001, andmcp.dbshould appear after startup. The logs should move pastdb_isreadyand run migrations.Dokploy-specific notes
ports:mapping. HTTPS is also whySECURE_COOKIES=trueworks. Over plain HTTP, admin UI login fails silently../databind mounts. Dokploy rewrites the compose directory on deploy. If you prefer a bind mount, use Dokploy's../files/convention (e.g.../files/mcp-data:/data) and chown that host folder to10001:10001.docker ps -a --filter name=init-perms --format '{{.Names}} {{.Status}} {{.Command}}'Production tip
SQLite with multiple Gunicorn workers and
CACHE_TYPE=databaseis fine for light use. Under heavier load you may hitdatabase is locked. In that case, move to Postgres (and Redis for caching).Troubleshooting checklist
unable to open database file/datanot writable by uid 10001/dataowned by the wrong UID after redeploySECURE_COOKIES=trueover plain HTTPdatabase is lockedAll reactions