docker启动容器失败:cannot access ‘/docker-entrypoint-initdb.d/‘: Operation not permitted

记一次docker启动项目失败:

启动postgresql时docker启动失败,docker ps 显示如下图所示

[root@s73 ~]# docker ps -a
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS                     PORTS               NAMES
b9ce1ebd3d63        postgres:12         "docker-entrypoint.s…"   7 seconds ago       Exited (2) 7 seconds ago  

然后查看日志

[root@s73 ~]# docker logs pgsql12
ls: cannot access '/docker-entrypoint-initdb.d/': Operation not permitted

好像是权限的问题,stack overflow也有人出现了同样的问题,尝试了answer的方法,无效

Cannot start PostgreSQL Docker container – "'/docker-entrypoint-initdb.d/': Operation not permitted" - Stack Overflowicon-default.png?t=M4ADhttps://stackoverflow.com/questions/69706677/cannot-start-postgresql-docker-container-docker-entrypoint-initdb-d-oper

问题解决,在docker run时额外加上参数 --privileged问题解决,

官网的解释是给容器额外的权限,看来还是权限不足的问题引起的 

docker启动容器失败:cannot access ‘/docker-entrypoint-initdb.d/‘: Operation not permitted_第1张图片

你可能感兴趣的:(docker,数据库,docker,容器,运维)