Reputation: 359
I am currently learning Docker, with the book "Using 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. Is there something I can do to have it work?
I use:
1.12.0
1.8.0
, build d988a55
DockerFile:
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:
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.
The working docker command, which starts the container and the web server, exposing it successfully to my Windows host:
docker run -e "ENV=DEV" -p 5000:5000 identidock
The docker-compose up
command fails with the following message:
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.
Upvotes: 5
Views: 16213
Reputation: 623
In my case I needed to run the command line (git bash) as administrator then run again :
docker-compose up -d .
this worked for me.
Upvotes: 1
Reputation: 35348
Try adding
RUN chmod +x /cmd.sh
to your Dockerfile after
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
It may be that the docker client sets the executable bit for all files, where as Compose does not (yet).
Upvotes: 8