Skip to content

fix(docker): fix SQLite unable to open database in container - #28

Merged
ArianAr merged 1 commit into
mainfrom
fix/docker-sqlite-data-dir
Jul 16, 2026
Merged

fix(docker): fix SQLite unable to open database in container#28
ArianAr merged 1 commit into
mainfrom
fix/docker-sqlite-data-dir

Conversation

@ArianAr

@ArianAr ArianAr commented Jul 16, 2026

Copy link
Copy Markdown
Owner

Summary

Fixes Docker startup failure:

```
database: open sqlite: unable to open database file: out of memory (14)
```

SQLite error 14 is `SQLITE_CANTOPEN` (not a real OOM). Cause: `/data/gantry.db` with missing/unwritable `/data` under distroless nonroot.

Closes #27

Changes

  • `db.Open`: `MkdirAll` parent of DB path + clearer error
  • Dockerfile: create `/data` owned by uid 65532 before runtime
  • Unit test + README note
  • Local smoke: `docker run` healthz/readyz OK

Test

  • `go test ./pkg/db/...`
  • `docker build` + `docker run` healthz/readyz

Create DB parent directories on open and ship a nonroot-owned /data
directory in the distroless image so docker run no longer fails with
SQLITE_CANTOPEN ("out of memory (14)").
@ArianAr ArianAr added bug Something isn't working backend Go server and API labels Jul 16, 2026

@ArianAr ArianAr left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review: root cause is CANTOPEN on /data; MkdirAll + pre-created /data is the right fix. Approve when CI green.

@ArianAr
ArianAr enabled auto-merge (squash) July 16, 2026 18:47
@ArianAr
ArianAr merged commit 3547d06 into main Jul 16, 2026
8 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend Go server and API bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: docker sqlite unable to open database file (out of memory 14)

1 participant