Docker启动报错:cannot access ‘docker-entrypoint-initdb.d‘ Operation not permitted
·
Docker启动报错:cannot access ‘/docker-entrypoint-initdb.d/’: Operation not permitted
场景
部署mysql的时候,启动失败
参考
原因是CentOS7中的安全模块selinux把权限禁掉了
解决方法
在运行容器的时候,给容器加特权,及加上 --privileged=true
mysql compose文件
networks:
1panel-network:
external: true
services:
mysql:
command:
- --default-authentication-plugin=mysql_native_password
container_name: ${CONTAINER_NAME}
deploy:
resources:
limits:
cpus: ${CPUS}
memory: ${MEMORY_LIMIT}
environment:
MYSQL_ROOT_PASSWORD: ${PANEL_DB_ROOT_PASSWORD}
image: mysql:8.2.0
labels:
createdBy: Apps
networks:
- 1panel-network
ports:
- ${HOST_IP}:${PANEL_APP_PORT_HTTP}:3306
privileged: true
restart: always
volumes:
- ./data/:/var/lib/mysql
- ./conf/my.cnf:/etc/my.cnf
- ./log:/var/log/mysql
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
更多推荐
所有评论(0)