[英]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 image → start 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 标记
13
和14
似乎正在使用 Debian 的bullseye
,这似乎改变了文件系统方面的事情。
At the moment there are two solutions:目前有两种解决方案:
13-buster
, ie Docker tag postgres:13.4-buster
, as it seems 14
does not have a -buster
equivalent.13-buster
,即 Docker 标签postgres:13.4-buster
,因为14
似乎没有-buster
等价物。20.10.6
, it seems to fix the issue.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.