Docker Compose volume write permission issue

The non-root service cannot write to its volume.

Problem

The non-root service cannot write to its volume.

Cause

Volume permissions may not allow writes by the lab runtime UID 10001.

Solution

Compare the running UID and mount permissions. Make the volume writable by the intended UID and verify the counter survives recreation. Removing the volume destroys data.

docker compose exec web id -u
docker compose exec web ls -ld /data

View solution source on GitHub