简体   繁体   English

无法启动 PostgreSQL Docker 容器 – “'/docker-entrypoint-initdb.d/': 不允许操作”

[英]Cannot start PostgreSQL Docker container – "'/docker-entrypoint-initdb.d/': Operation not permitted"

Trying to start a PostgreSQL container according to the instructions at https://hub.docker.com/_/postgres ( How to use this imagestart a postgres instance ),尝试根据https://hub.docker.com/_/postgres的说明启动 PostgreSQL 容器(如何使用此映像启动 postgres 实例

docker run -e POSTGRES_PASSWORD=mysecretpassword postgres:14

gives the following error:给出以下错误:

ls: cannot access '/docker-entrypoint-initdb.d/': Operation not permitted ls: 无法访问'/docker-entrypoint-initdb.d/': 不允许操作

The only change was removing the --name and -d parameter while using the version tag 14 of PostgreSQL.唯一的变化是在使用 PostgreSQL 的版本标签14时删除了--name-d参数。 But even with the exact same command from Docker Hub the same error shows up.但即使使用来自 Docker 集线器的完全相同的命令,也会出现相同的错误。

Why is that and how can it be fixed?为什么会这样,如何解决? Is it a bug in the PostgreSQL image or a system configuration issue?是 PostgreSQL 映像中的错误还是系统配置问题?


Additional information:附加信息:

$ docker version
Client:
 Version:    17.12.0-ce
 API version:    1.35
 Go version:    go1.9.2
 Git commit:    c97c6d6
 Built:    Wed Dec 27 20:10:45 2017
 OS/Arch:    linux/amd64

Server:
 Engine:
  Version:    17.12.0-ce
  API version:    1.35 (minimum version 1.12)
  Go version:    go1.9.2
  Git commit:    c97c6d6
  Built:    Wed Dec 27 20:09:19 2017
  OS/Arch:    linux/amd64
  Experimental:    false

$ uname -r
5.13.0-16-generic

$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=21.10
DISTRIB_CODENAME=impish
DISTRIB_DESCRIPTION="Ubuntu 21.10"

$ docker images postgres:latest
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
postgres            latest              14e58c3f6369        6 days ago          374MB
$ docker images postgres:14
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
postgres            14                  14e58c3f6369        6 days ago          374MB

It looks like it works with postgres:14-alpine .看起来它适用于postgres:14-alpine

I bumped into the same issue.我遇到了同样的问题。

PostgreSQL Docker tags 13 and 14 seem to be using Debian's bullseye which seems to change things in regards to the file system. PostgreSQL Docker 标记1314似乎正在使用 Debian 的bullseye ,这似乎改变了文件系统方面的事情。

At the moment there are two solutions:目前有两种解决方案:

  1. Downgrade to PostgreSQL 13-buster , ie Docker tag postgres:13.4-buster , as it seems 14 does not have a -buster equivalent.降级到 PostgreSQL 13-buster ,即 Docker 标签postgres:13.4-buster ,因为14似乎没有-buster等价物。
  2. Upgrade current Docker you are running.升级您正在运行的当前 Docker。 From Docker version onwards 20.10.6 , it seems to fix the issue.从 Docker 版本20.10.6开始,它似乎解决了这个问题。

As a reference to the issue on GitHub related to this issue, you can find it at root user has no permissions within container #884 .作为 GitHub 上与此问题相关的问题的参考,您可以在root user has no permissions within container #884中找到它。

For posterity, the solution from GitHub:对于后代,来自 GitHub 的解决方案:

you'll need to update Docker, runc, and likely libseccomp on your host.您需要更新主机上的 Docker、runc 和可能的 libseccomp。

如果您不能或不想(无论出于何种原因)升级 Docker,一个快速的解决方法是使用不同的标签,例如postgres:14-alpine

版本postgres:12.9出现问题 升级到版本postgres:13-alpine修复此问题。

Upgrading docker version to 20.* worked.将 docker 版本升级到 20.* 工作。

暂无
暂无

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

相关问题 使用 docker-entrypoint-initdb.d 脚本初始化 PostgreSQL 容器 - Initialize PostgreSQL Container with docker-entrypoint-initdb.d script docker-entrypoint-initdb.d 中的 Docker PostgreSQL 初始化脚本无法导入文件 - Docker PostgreSQL initialisation script laced in docker-entrypoint-initdb.d’ fails to import file 如何解决空docker-entrypoint-initdb.d的问题? (PostgresQL + Docker) - How to solve problem with empty docker-entrypoint-initdb.d? (PostgresQL + Docker) Docker PostgreSQL - /docker-entrypoint-initdb.d中的脚本无法运行 - Docker PostgreSQL - Scripts in /docker-entrypoint-initdb.d doesn't run 为什么 postgres 容器在 Gitlab CI 中忽略 /docker-entrypoint-initdb.d/* - Why is postgres container ignoring /docker-entrypoint-initdb.d/* in Gitlab CI 初始化postgres数据库(不使用/docker-entrypoint-initdb.d) - Initialize postgres database (without using /docker-entrypoint-initdb.d) docker-entrypoint-initdb.d 错误解释器:权限被拒绝 - docker-entrypoint-initdb.d bad interpreter: Permission denied flyway 无法连接到 docker-entrypoint-initdb.d 脚本中的 postgres 容器 - flyway unable to connect to postgres container within 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
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM