I'm creating an entrypoint for a Docker container, and then attempting to run it using a docker-compose.yml
file. This works just fine in Ubuntu and OS X, but I get a permissions error (without much additional information) in Windows
Here is the Dockerfile:
FROM node:6.9
MAINTAINER Some Dude <[email protected]>
WORKDIR /opt
# Install Compass
RUN DEBIAN_FRONTEND=noninteractive apt-get -y dist-upgrade
RUN apt-get -y update
RUN apt-get -y install gcc rubygems ruby-dev
RUN gem update --system
RUN gem install compass
# Install Compass Extensions
RUN gem install compass-blend-modes compass-import-once
# Install glup globally
RUN npm install -g gulp
# Copy the setup file
COPY setup/gulp/docker-gulp-setup.sh /usr/local/bin/docker-gulp-setup.sh
RUN chmod +x /usr/local/bin/docker-gulp-setup.sh
CMD ['gulp']
Here is the docker-compose.yml entry:
version: '2'
services:
mycontainer-for-gulp:
build:
context: .
dockerfile: Dockerfile.gulp
volumes:
- ./:/opt:Z
command: /usr/local/bin/docker-gulp-setup.sh
Here is the output when the build command is run on Windows:
λ docker-compose build mycontainer-for-gulp
Building mycontainer-for-gulp
Traceback (most recent call last):
File "<string>", line 3, in <module>
File "compose\cli\main.py", line 65, in main
File "compose\cli\main.py", line 117, in perform_command
File "compose\cli\main.py", line 223, in build
File "compose\project.py", line 300, in build
File "compose\service.py", line 742, in build
File "site-packages\docker\api\build.py", line 55, in build
File "site-packages\docker\utils\utils.py", line 95, in tar
File "tarfile.py", line 2023, in add
File "tarfile.py", line 2052, in addfile
File "tarfile.py", line 278, in copyfileobj
IOError: [Errno 13] Permission denied
docker-compose returned -1
Note that it IS the COPY
command that's generating the error, because we tried commenting out both that and the RUN chmod
statement individually.
When I run a raw docker build query:
docker build -f Dockerfile.gulp .
Then I get a bunch of error output as it tries to tar up the current directory. Basically every file add fails. Full output is here:
https://gist.github.com/danieltalsky/4cb6bddb6534c46b051230bc45578072
Differences between CMD & ENTRYPOINT CMD commands are ignored by Daemon when there are parameters stated within the docker run command while ENTRYPOINT instructions are not ignored but instead are appended as command line parameters by treating those as arguments of the command.
Docker ENTRYPOINT In Dockerfiles, an ENTRYPOINT instruction is used to set executables that will always run when the container is initiated. Unlike CMD commands, ENTRYPOINT commands cannot be ignored or overridden—even when the container runs with command line arguments stated.
COPY is a docker file command that copies files from a local source location to a destination in the Docker container. ADD command is used to copy files/directories into a Docker image. It only has only one assigned function. It can also copy files from a URL.
I was facing the same issue when I tried to build the Docker image while the application was still running in the IDE.
Make sure to shutdown your application before building your image
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With