Environment:
Docker compose version: Docker Compose version v2.24.5-desktop.1
System: MacOS 14.2.1 (23C71)
Last Commit when bug happen: 084d1885565c6c0fbb356bb69c43ed3eef0982e5
Steps to Reproduce:
Clone the repository from the main branch.
Execute yarn install.
Copy and paste configurations into the config folder.
Run docker-compose up.
Observe the error during the startup of the db-init-1 service.
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 permitted
Additional 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 connections
This 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.
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: 084d1885565c6c0fbb356bb69c43ed3eef0982e5
Steps to Reproduce:
yarn install
.config
folder.docker-compose up
.db-init-1
service.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:Additional Information
After investigating the problem, I found that official postgres docker image README has a part for using arbitrary user usage for postgres.
This 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.