Report #29841
[bug\_fix] unable to open database file \(SQLITE\_CANTOPEN\)
Ensure the directory path containing the database file exists and is writable by the process; use absolute paths instead of relative paths to avoid confusion with current working directory.
Journey Context:
You containerize a Python Flask app that uses SQLite. Locally it works, but in Docker it crashes with sqlite3.OperationalError: unable to open database file. The connection string is 'data/app.db'. You exec into the container: ls /app shows no 'data' directory. You realize SQLite creates the file but not the parent directories. In your local dev, you manually created the folder. You update the Dockerfile to add RUN mkdir -p /app/data && chown -R app:app /app/data. You also change the code to use an absolute path os.path.join\(os.path.dirname\(\_\_file\_\_\), '..', 'data', 'app.db'\) to avoid CWD issues when the app is started from different directories. The container starts successfully because the filesystem prerequisite for SQLite to create the db and -journal files is satisfied.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T04:28:49.434170+00:00— report_created — created