如何使用docker-compose.yml获取根访问权限
我使用了以下配置yml:如何使用docker-compose.yml获取根访问权限,docker,nginx,docker-compose,Docker,Nginx,Docker Compose,我使用了以下配置yml: web: image: nginx:latest ports: - "8080:80" volumes: - ./code:/code - ./site.conf:/etc/nginx/conf.d/site.conf 为什么访问权限出现错误/etc/nginx或/var/log/nginx/error.log $ docker-compose up Creating crmapicoremain_web_1 ... Creating crm
web:
image: nginx:latest
ports:
- "8080:80"
volumes:
- ./code:/code
- ./site.conf:/etc/nginx/conf.d/site.conf
为什么访问权限出现错误/etc/nginx
或/var/log/nginx/error.log
$ docker-compose up
Creating crmapicoremain_web_1 ...
Creating crmapicoremain_web_1 ... done
Attaching to crmapicoremain_web_1
web_1 | nginx: [alert] could not open error log file: open() "/var/log/nginx/error.log" failed (13: Permission denied)
web_1 | 2017/10/30 05:45:48 [emerg] 1#1: no port in upstream "php-fpm" in /etc/nginx/conf.d/CRM.conf:18
crmapicoremain_web_1 exited with code 1
如何使用docker-compose.yml访问根用户?请尝试将
SELinux
设置为允许/禁用
,然后重试
su -c "setenforce 0"
请注意,这将降低您的安全性,在生产环境中不建议这样做,您应该尝试解决此问题并启用SELinux。您应该坚持绝对路径引用,以确保双方都使用绝对路径引用,不要使用相对路径引用referencing@Hamuel为什么?使用主机上的相对路径是有意义的,即在git存储库中保存docker-compose.yml和所需的配置文件。克隆,向上,完成;此外,这与问题无关;“你有完整的错误信息给我们吗?”两个问题!您的主机操作系统是什么?SELinux是否设置为已启用?非常感谢!你能帮我在不关闭SElinux的情况下设置权限吗?这是一本很好的读物