7

Docker file content: Error - Dockerfile parse error line 7: COPY requires at least two arguments, but only one was provided. Destination could not be determined

FROM node:10-alpine

RUN mkdir -p /home/node/app/node_modules && chown -R node:node /home/node/app

WORKDIR /home/node/app

COPY package*.json ./

USER node

RUN npm install

COPY --chown=node:node . .

EXPOSE 8080

CMD [ "node", "app.js" ]

5 Answers 5

2

The full, proper way to do it is:

COPY --chown=node:node . ./

That is because COPY expects 2 arguments (as the error message says), it just doesn't like the second bare dot.

1
COPY --chown=node:node ./  --> just try this, it should work.
1
  • 4
    While this code may answer the question, providing additional context regarding why and/or how this code answers the question improves its long-term value. I would recommend you to check SO's official How to Answer article along with the comprehensive blog post from Jon Skeet. Jun 9, 2020 at 11:45
1

I was forgetting to include a dot after COPY package.json in my Dockerfile.

My full working Dockerfile

FROM node:alpine

WORKDIR /app
COPY package.json . 

RUN npm install

COPY . .

CMD ["npm", "start"]
0

adding app.jar in suffix worked for me

COPY target/com.me.xxxxx-1.0.0.jar app.jar

-3

On line 7 - COPY --chown=node:node . . Both source and destination are the same which is invalid.

The source and destination should be different.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.