[英]Permission Denied with Docker-Compose on Windows
I am currently learning Docker, with the book "Using Docker".我目前正在通过《使用 Docker》一书学习 Docker。 In chapter 5, the author switches from using
docker run
to using docker compose
, which yields a permission denied
error in my test application.在第 5 章中,作者从使用
docker run
切换到使用docker compose
,这在我的测试应用程序中产生了permission denied
错误。 Is there something I can do to have it work?我可以做些什么让它工作吗?
I use:我用:
1.12.0
1.12.0
1.8.0
, build d988a55
1.8.0
,构建d988a55
DockerFile : Docker 文件:
FROM python:3.4
RUN groupadd -r uwsgi && useradd -r -g uwsgi uwsgi
RUN pip install Flask==0.10.1 uWSGI==2.0.8
WORKDIR /app
COPY app /app
COPY cmd.sh /
EXPOSE 9090 9191
USER uwsgi
CMD ["/cmd.sh"]
docker-compose.yml :码头工人-compose.yml :
identidock:
build: .
ports:
- "5000:5000"
environment:
ENV: DEV
volumes:
- ./app:/app
The application is located under C:/Users/MyUserName
, as required by the Toolbox, to have shared volumes working correctly.根据工具箱的要求,该应用程序位于
C:/Users/MyUserName
下,以使共享卷正常工作。
The working docker command, which starts the container and the web server, exposing it successfully to my Windows host:正在运行的 docker 命令,它启动容器和 Web 服务器,将其成功地暴露给我的 Windows 主机:
docker run -e "ENV=DEV" -p 5000:5000 identidock
The docker-compose up
command fails with the following message: docker-compose up
命令失败并显示以下消息:
Starting identidock_identidock_1
ERROR: for identidock Cannot start service identidock: oci runtime error: exec: "/cmd.sh": permission denied
←[31mERROR←[0m: Encountered errors while bringing up the project.
Try adding尝试添加
RUN chmod +x /cmd.sh
to your Dockerfile after之后到你的 Dockerfile
COPY cmd.sh /
According to that issue it seems that the docker client sets the needed exec permission for the file while docker compose does not根据那个问题,docker客户端似乎为文件设置了所需的执行权限,而docker compose没有
It may be that the docker client sets the executable bit for all files, where as Compose does not (yet).
可能是 docker 客户端为所有文件设置了可执行位,而 Compose 没有(还)。
In my case I needed to run the command line (git bash) as administrator then run again :在我的情况下,我需要以管理员身份运行命令行(git bash)然后再次运行:
docker-compose up -d .
this worked for me.这对我有用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.