简体   繁体   English

docker-entrypoint-initdb.d 错误解释器:权限被拒绝

[英]docker-entrypoint-initdb.d bad interpreter: Permission denied

Hi I a using postgres docker-compose in my application.嗨,我在我的应用程序中使用postgres docker-compose When I am trying to run it on my local machine (macOS Big Sur) I am getting below error and postgres container exited.当我尝试在我的本地机器 (macOS Big Sur) 上运行它时,我遇到错误并且postgres容器退出。

 /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下面是我的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:对于任何面临这种情况的人,您需要授予脚本文件的执行权限,因为 Docker 会复制权限:

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然后我给了my-initdb.sh执行权限,它运行良好

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Docker-Compose + Postgres:/docker-entrypoint-initdb.d/init.sql:权限被拒绝 - Docker-Compose + Postgres: /docker-entrypoint-initdb.d/init.sql: Permission denied Docker 入口点 initdb 权限被拒绝 - Docker entrypoint initdb PERMISSION DENIED 初始化postgres数据库(不使用/docker-entrypoint-initdb.d) - Initialize postgres database (without using /docker-entrypoint-initdb.d) /docker-entrypoint-initdb.d 文件夹中的脚本被忽略 - Scripts in the /docker-entrypoint-initdb.d folder are ignored 使用 docker-entrypoint-initdb.d 脚本初始化 PostgreSQL 容器 - Initialize PostgreSQL Container with docker-entrypoint-initdb.d script 在Windows上运行Docker映像-docker-entrypoint.sh采购/docker-entrypoint-initdb.d - Running docker images on Windows - docker-entrypoint.sh sourcing /docker-entrypoint-initdb.d docker-entrypoint.sh 忽略 /docker-entrypoint-initdb.d/my.backup - docker-entrypoint.sh ignoring /docker-entrypoint-initdb.d/my.backup 如何解决空docker-entrypoint-initdb.d的问题? (PostgresQL + Docker) - How to solve problem with empty docker-entrypoint-initdb.d? (PostgresQL + Docker) 使用 /docker-entrypoint-initdb.d 初始化 postgres docker 时不会创建表 - Tables are not created when initialize postgres docker with /docker-entrypoint-initdb.d docker alpine postgres在撰写中不执行docker-entrypoint-initdb.d脚本 - docker alpine postgres in compose not executing docker-entrypoint-initdb.d scripts
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM