Docker root 运行提示文件Permission denied
解决方法
方法1:(生产不建议) 检查 SELinux 是否启用 getenforce 如果输出是 Enforcing,说明 SELinux 已启用。 临时关闭 sudo setenforce 0 方法2: 如果确认 SELinux 导致问题,可以在 docker-compose.yml 中挂载卷时添加 :z 标志 volumes: - ./nacos:/home/nacos:z 方法3:(建议) 查看当前上下文 ls -ldZ 输出示例: drwxr-xr-x. root root unconfined_u:object_r:home_root_t:s0 . 容器可访问输出示例: drwxr-xr-x. root root unconfined_u:object_r:container_file_t:s0 env 为挂载目录设置为容器可访问的上下文(svirt_sandbox_file_t) sudo chcon -Rt svirt_sandbox_file_t ./nacos