First boot fails: Stalwart exits with "Permission denied" on /var/lib/stalwart #4
|
Fresh clone, The directory exists and I am running compose as root, so why can it not write? |
Replies: 1 comment
|
Running compose as root is exactly why it looks confusing: the containers do not run as root. Both images drop privileges:
When Docker creates a missing bind-mount source directory it makes it root-owned. The unprivileged process inside then cannot write to it, so RocksDB fails on its very first append and Stalwart exits. The web container hits the same wall a moment later when it tries to create its SQLite file. Fixcd raymail
mkdir -p stalwart/etc stalwart/data/logs data
sudo chown -R 2000:2000 stalwart/etc stalwart/data
sudo chown -R 1001:1001 data
docker compose up -dThen confirm the ownership actually took: ls -ldn stalwart/data data
# drwxr-xr-x 2000 2000 ... stalwart/data
# drwxr-xr-x 1001 1001 ... dataThe numeric uids matter, not names — those users do not exist on the host, only inside the images, so Why
|
Running compose as root is exactly why it looks confusing: the containers do not run as root.
Both images drop privileges:
raymail-stalwartstalwart)./stalwart/etc,./stalwart/dataraymail-webraymail)./dataWhen Docker creates a missing bind-mount source directory it makes it root-owned. The unprivileged process inside then cannot write to it, so RocksDB fails on its very first append and Stalwart exits. The web container hits the same wall a moment later when it tries to create its SQLite file.
Fix
cd raymail mkdir -p stalwart/etc stalwart/data/logs data sudo chown -R 2000:2000 stalwart/etc stalwart/data sudo chown -R 1001:1…