Home > Mobile >  COPY --from=0 Docker Gitlab
COPY --from=0 Docker Gitlab

Time:09-04

I have a problem in the CI/CD jobs gitlab.

Step 2/5 : COPY --from=0 / /
invalid from flag value 0: refers to current build stage

My dockerfile :

FROM node:18.8.0-buster
COPY --from=0 / /
WORKDIR /usr/src/app
COPY ./ /usr/src/app/
CMD [ "node","index.js" ]

CodePudding user response:

Quotting from https://docs.docker.com/develop/develop-images/multistage-build/#name-your-build-stages

By default, the stages are not named, and you refer to them by their integer number, starting with 0 for the first FROM instruction

You should remove COPY --from=0 / /, since you are in the stage with index 0 since this is your first build stage.

You are basically copying from the stage 0 to the stage 0, that's why docker complains

  • Related