尝试在 Fedora coreos 上使用 docker-compose 运行 docker nginx 映像,13:权



尝试使用 sudo docker-compose up 运行我的 nginx docker-compose 映像时,出现以下错误:

production_nginx | /docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
production_nginx | /docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
production_nginx | /docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
production_nginx | 10-listen-on-ipv6-by-default.sh: /etc/nginx/conf.d/default.conf is not a file or does not exist, exiting
production_nginx | /docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
production_nginx | /docker-entrypoint.sh: Configuration complete; ready for start up
production_nginx | nginx: [alert] could not open error log file: open() "/var/log/nginx/error.log" failed (13: Permission denied)
production_nginx | 2020/07/04 22:04:37 [emerg] 1#1: open() "/var/log/nginx/error.log" failed (13: Permission denied)

我的 docker 撰写文件如下所示:

version: "3.7"
services:
nginx:
image: nginx:latest
container_name: production_nginx
restart: always
ports:
- "80:80"
- "443:443"
volumes:
- /etc/letsencrypt/:/etc/letsencrypt/
- /opt/nginx_cache/:/opt/nginx_cache/
- /var/home/core/config/nginx/dhparam.pem:/etc/nginx/dhparam.pem
- /var/home/core/config/nginx/conf.d/:/etc/nginx/conf.d/
- /var/home/core/config/files/:/var/home/core/config/files/
- /var/home/core/config/nginx/nginx.conf:/etc/nginx/nginx.conf
- /var/log/nginx/:/var/log/nginx/
networks:
- proxynet
- abnet
- dsnet

文件夹/var/log/nginx的权限如下所示:drwxr-xr-x. 2 root root 41 Jul 4 22:04 nginx

我已经像这样对文件进行了沙盒化:sudo chcon -Rt svirt_sandbox_file_t /var/log/nginx.

它可能是 SELinux 阻止了访问,但不建议禁用它,因为我打算在打开它的情况下运行!

将 :Z 添加到所有卷挂载: -/etc/letsencrypt/:/etc/letsencrypt/:Z 它应该可以工作(docker 容器的 volumes-from 选项中的"z"标志是什么?(。

相关内容

  • 没有找到相关文章

最新更新