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),
docker run -e POSTGRES_PASSWORD=mysecretpassword postgres:14
gives the following error:
ls: cannot access '/docker-entrypoint-initdb.d/': Operation not permitted
The only change was removing the --name
and -d
parameter while using the version tag 14
of PostgreSQL. But even with the exact same command from Docker Hub the same error shows up.
Why is that and how can it be fixed? Is it a bug in the PostgreSQL image or a system configuration issue?
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
.
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.
At the moment there are two solutions:
13-buster
, i.e. Docker tag postgres:13.4-buster
, as it seems 14
does not have a -buster
equivalent.20.10.6
, it seems to fix the issue.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 .
For posterity, the solution from GitHub:
you'll need to update Docker, runc, and likely libseccomp on your host.