-
Notifications
You must be signed in to change notification settings - Fork 87
Description
Hello Maintainers,
Environment:
Docker compose version: Docker Compose version v2.24.5-desktop.1
System: MacOS 14.2.1 (23C71)
Last Commit when bug happen: 084d188
Steps to Reproduce:
- Clone the repository from the main branch.
- Execute
yarn install. - Copy and paste configurations into the
configfolder. - Run
docker-compose up. - Observe the error during the startup of the
db-init-1service.
Expected Behavior:
The db-init-1 service initializes the database without permission errors.
Actual Behavior:
The db-init-1 service fails with the following permission error for several files:
db-init-1 | chown: changing ownership of '/var/lib/postgresql/data/._pg_subtrans': Operation not permittedAdditional Information
After investigating the problem, I found that official postgres docker image README has a part for using arbitrary user usage for postgres.
$ docker volume create pgdata
$ docker run -it --rm -v pgdata:/var/lib/postgresql/data -e POSTGRES_PASSWORD=mysecretpassword postgres
The files belonging to this database system will be owned by user "postgres".
( once it's finished initializing successfully and is waiting for connections, stop it )
$ docker run -it --rm -v pgdata:/var/lib/postgresql/data bash chown -R 1000:1000 /var/lib/postgresql/data
$ docker run -it --rm --user 1000:1000 -v pgdata:/var/lib/postgresql/data postgres
LOG: database system was shut down at 2017-01-20 00:03:23 UTC
LOG: MultiXact member wraparound protections are now enabled
LOG: autovacuum launcher started
LOG: database system is ready to accept connectionsThis guide solves the problem.
P.S
On db.yml, stats.yml and docker-compose.yml, db-init services commented out
IMHO
My take on this bug is, db-init does not allow db to initialise before runs the "sh -c chown ***" command.
Probably, it is something different causes the bug but above solution helped me out to proceed. Step-by-step guide on the README currently stuck at second step.
I hope it helps.