Say which path and user cannot open the database
sql.Open is lazy, so a permission problem surfaced from whichever query ran first: "create schema_migrations: unable to open database file (14)", which names neither the file nor the reason. Ping on open and report the path and the effective uid and gid instead. The cause in practice is a bind-mounted ./data that Docker created as root while the container runs as FOODSTER_UID. Documented in the README.
This commit is contained in:
@@ -181,6 +181,16 @@ That directory must exist and be owned by the user compose runs as — `make up`
|
||||
creates it, and `FOODSTER_UID`/`FOODSTER_GID` in `.env` tell the container who
|
||||
that is. Get them from `id -u` and `id -g`.
|
||||
|
||||
If the app exits with `cannot open /data/foodster.db ... unable to open
|
||||
database file (14)`, the ownership does not match. Docker creates a missing
|
||||
bind-mount directory as root, and the container is not root:
|
||||
|
||||
```sh
|
||||
ls -ldn data # whose is it?
|
||||
sudo chown -R 1000:1000 data # match FOODSTER_UID / FOODSTER_GID
|
||||
docker compose restart
|
||||
```
|
||||
|
||||
## Security
|
||||
|
||||
Access is a single shared password over HTTP Basic — no accounts, no
|
||||
|
||||
Reference in New Issue
Block a user