docker-compose up 报 container init caused write keycreate permission denied unknown

Starting pmcc-openmaptiles ... error
Starting pmcc-portainer    ... 

ERROR: for pmcc-openmaptiles  Cannot start service openmaptiles: OCI runtime create failed: container_linux.go:346: starting container process caused "process_linux.go:449: container init caused \"write /proc/self/attr/keycreate: permission denied\""
Starting pmcc-portainer    ... error

ERROR: for pmcc-portainer  Cannot start service portainer: OCI runtime create failed: container_linux.go:346: starting container process caused "process_linux.go:449: container init caused \"write /proc/self/attr/keycreate: permission denied\"": unknown

ERROR: for openmaptiles  Cannot start service openmaptiles: OCI runtime create failed: container_linux.go:346: starting container process caused "process_linux.go:449: container init caused \"write /proc/self/attr/keycreate: permission denied\"": unknown

ERROR: for portainer  Cannot start service portainer: OCI runtime create failed: container_linux.go:346: starting container process caused "process_linux.go:449: container init caused \"write /proc/self/attr/keycreate: permission denied\"": unknown
ERROR: Encountered errors while bringing up the project.

找了很久,最后是因为我使用root用户复制文件到服务器,但是运行 docker-compose up时使用的用户是docker

解决办法:

1.      修改文件或目录的所有者(chown)

sudo chown -R docker html

其中docker是用户名,html是文件夹名,如果是文件就不用-R,文件夹及子目录就加-R,修改完用ll -a查看文件权限

2.      修改文件或目录的用户组

sudo chgrp -R docker nginx.conf

 其中docker是用户名,nginx,conf是文件名,如果是文件就不用-R,文件夹及子目录就加-R,修改完用ll -a查看文件权限

3.     查看权限是否修改完成

 

你可能感兴趣的:(docker,docker)