Search code examples
dockerdocker-machine

Copy Instruction of the docker


I am executing a docker file containing the following content .

# Run npm install
RUN cd /srv/package/ && npm install --loglevel info && npm cache clean

WORKDIR ${HOME}

COPY ./.eslintrc.json \
./.eslintignore/

# Clean up environment
USER root

I am getting the following error due to the fact that my Copy instruction is not ended properly.

Step 6 : COPY ./.eslintrc.json ./.eslintignore USER root
lstat USER: no such file or directory

I went through the docker documentation. Even after trying to use front slash, dot or leaving it without any termination symbols didn’t fetch me the expected result. Any help will be appreciated.


Solution

  • This is because COPY takes a second argument, the destination.

    COPY ./.eslint.json\
        ./.eslintignore/ <destination needed>
    

    So it's assuming USER is your destination