I'm getting this permission denied from Postgres when I inspect the volume.
My user and databases are not created because of this permission issue. I can confirm this by running command docker exec -it <cont_name> bin/bash
and inspect postgres
container and there's no user.
It didn't happened before I reformat my mac book so I don't know what happened. I'm running Mac OS Catalina and running latest Docker.
Here's the db service of my yml file
db:
image: postgres:9.6
environment:
- DB_USER=sales_store # used by psql to create rails user
- DB_PASSWORD=localpostgres # used by psql to create rails user
- POSTGRES_PASSWORD=localpostgressu # used by psql
- DB_RESTORE_DATABASE=sales_store_development
deploy:
placement:
constraints: [node.role==manager]
ports:
- "5432:5432"
volumes:
- db-data:/var/lib/postgresql/data # mount data to host
- ./init/db/0-init-user-db.sh:/docker-entrypoint-initdb.d/0-init-user-db.sh # database init (fork of sales-store's init)
# restore from .sql.gz file
- ./backup/db/sales_store_ist.sql.gz:/1-restore-backup.sql.gz # copy backup file to container
- ./init/db/1-restore-backup.sh:/docker-entrypoint-initdb.d/1-restore-backup.sh # run psql restore;
networks:
- db-network
What I did to fix this but didn't work:
I tried running this command
chmod +x docker-entrypoint.sh
from this link -- but didn't workI gave read write permission to my volumes folder --- but didn't work
I read this Initialize PostgreSQL Container with docker-entrypoint-initdb.d script
but the author fixes it by altering the yml file. I don't want to do that because I've never done that before and it was running until I reformatted my Mac. I'm assuming it's my Docker, or it's my root folder, and I need to give everyone read and write permission?