简体   繁体   English

尝试正式运行Docker时,运行'docker-compose up'引发权限被拒绝

[英]Running 'docker-compose up' throws permission denied when trying official samaple of Docker

I am using Docker 1.13 community edition on a CentOS 7 x64 machine. 我在CentOS 7 x64机器上使用Docker 1.13社区版。 When I was following a Docker Compose sample from Docker official tutorial , all things were OK until I added these lines to the docker-compose.yml file: 当我遵循Docker官方教程中的Docker Compose示例时,一切正常,直到我将以下行添加到docker-compose.yml文件中为止:

volumes:
 - .:/code

After adding it, I faced the following error: can't open file 'app.py': [Errno 13] Permission denied. 添加后,我遇到以下错误:无法打开文件'app.py':[Errno 13]权限被拒绝。 It seems that the problem is due to a SELinux limit. 看来问题出在SELinux限制。 Using this post I ran the following command: 这篇文章中,我运行了以下命令:

su -c "setenforce 0"

to solve the problem temporarily, but running this command: 暂时解决问题,但运行以下命令:

chcon -Rt svirt_sandbox_file_t /path/to/volume

couldn't help me. 无法帮助我。

Finally I found the correct rule to add to SELinux: 最后,我找到了添加到SELinux的正确规则:

# ausearch -c 'python' --raw | audit2allow -M my-python
# semodule -i my-python.pp

I found it when I opened the SELinux Alert Browser and clicked on 'Details' button on the row related to this error. 当我打开SELinux警报浏览器并单击与此错误相关的行上的“详细信息”按钮时,找到了它。 The more detailed information from SELinux: 来自SELinux的更详细的信息:

SELinux is preventing /usr/local/bin/python3.4 from read access on the file app.py. SELinux阻止了/usr/local/bin/python3.4对文件app.py的读取访问。

***** Plugin catchall (100. confidence) suggests ************************** *****插件包(100.置信度)建议**************************

If you believe that python3.4 should be allowed read access on the app.py file by default. 如果您认为默认情况下应允许python3.4对app.py文件进行读取访问。 Then you should report this as a bug. 然后,您应该将此报告为错误。 You can generate a local policy module to allow this access. 您可以生成本地策略模块以允许此访问。 Do allow this access for now by executing: 现在执行以下操作以允许此访问:

ausearch -c 'python' --raw | audit2allow -M my-python

semodule -i my-python.pp

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 运行 docker-compose 时,“拨打 unix /tmp/docker.sock:连接:权限被拒绝” - “dial unix /tmp/docker.sock: connect: permission denied” when running docker-compose up 运行 docker-compose up 后数据库权限被拒绝 - Database Permission denied after running docker-compose up docker-compose up Windows上的权限被拒绝 - docker-compose up Permission denied on Windows 权限被拒绝在virtualbox共享文件夹中尝试docker-compose build - Permission denied trying `docker-compose build` in virtualbox shared folder PermissionError: [Errno 13] 权限被拒绝: '/home/ceyedev/.aws' 运行 docker-compose up - PermissionError: [Errno 13] Permission denied: '/home/ceyedev/.aws' while running docker-compose up docker-compose 打开存储失败:运行时权限被拒绝错误 - docker-compose opening storage failed: permission denied error on running sh 文件上的 docker-compose up 权限被拒绝 - docker-compose up permission denied on sh file PermissionError: [WinError 5] Access Denied: [4776] 运行 docker-compose up 时无法执行脚本 docker-compose - PermissionError: [WinError 5] Access Denied: [4776] Failed to execute script docker-compose when running docker-compose up PermissionError: [Errno 13] Permission denied: '/app/manage.py' 尝试使用 docker-compose 创建项目时 - PermissionError: [Errno 13] Permission denied: '/app/manage.py' when trying to create project with docker-compose Docker-compose 和命名卷权限被拒绝 - Docker-compose and named volume permission denied
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM