Hi I a using postgres
docker-compose
in my application. When I am trying to run it on my local machine (macOS Big Sur) I am getting below error and postgres
container exited.
/usr/local/bin/docker-entrypoint.sh: running /docker-entrypoint-initdb.d/postgres-ssl.sh
/usr/local/bin/docker-entrypoint.sh: /docker-entrypoint-initdb.d/postgres-ssl.sh: /bin/bash: bad interpreter: Permission denied
Below is my docker-compose
postgres:
build:
context: ./setup/postgres
dockerfile: ./Dockerfile
command:
-c ssl=on -c ssl_cert_file=/var/lib/postgresql/ssl/certs/server.crt
-c ssl_key_file=/var/lib/postgresql/ssl/certs/server.key
-c ssl_ca_file=/var/lib/postgresql/ssl/certs/root.crt
ports:
- '5432:5432'
volumes:
- ./setup/postgres/scripts:/docker-entrypoint-initdb.d
environment:
- POSTGRES_HOST_AUTH_METHOD=trust
Am I missing any steps here?
I ended up running into this same issue. For anyone who faces this, you need to give execution permission to your script file, since Docker copies over permissions:
chmod +x your/script.sh
In my case the issue msg was:
/opt/bitnami/scripts/libpostgresql.sh: /docker-entrypoint-initdb.d/my-initdb.sh: /bin/bash: bad interpreter: Permission denied
Then I gave execution permission to my-initdb.sh
and it worked nicely
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With