Docker Community Forums

Share and learn in the Docker community.

Docker: Multi-stage "COPY --from" command looks for nonexistent container GUID and fails

(Davidcolenetscout) #1

I’m trying to package my team’s Angular app with an nginx frontend using a two-stage build on Docker 17.12.1-ce (Ubuntu 14.04). I always end up with an error message like the following during the build (the GUID reference varies on every build, but never exists in any form anywhere on the filesystem according to a find \ command):

COPY failed: stat /var/lib/docker/aufs/mnt/74bf91e19525a863953ff714480b08f99672bacf0c5d77cc3f40a6915f073a8f/app/dist: no such file or directory

I’d appreciate any help you might provide. My Dockerfile is as follows:

FROM node:8 as node


COPY package.json /app/
COPY .postman/package.json /app/.postman/
COPY ngp/package.json /app/ngp/
COPY lodash/package.json /app/lodash/
COPY translations/package.json /app/translations/
COPY api/package.json /app/api/
COPY worker/package.json /app/worker/
COPY mgmt/package.json /app/mgmt/
COPY shared/package.json /app/shared/
COPY ui/tsconfig.json /app/ui/
COPY ui/package.json /app/ui/
COPY ui/.angular-cli.json /app/ui/
COPY ui/src/ /app/ui/src/

RUN npm run preinstall
COPY ui/src/google-analytics-base.js /app/ui/src/google-analytics.js
RUN npm run install
COPY ./ /app/
RUN cd ui && npm run postinstall
RUN npm run build:ui
RUN cd ui && npm run setupGA

FROM nginx:1.13

#COPY --from=node /app/dist/ /usr/share/nginx/html
COPY --from=0 /app/dist/ /usr/share/nginx/html

COPY ./nginx-custom.conf /etc/nginx/conf.d/default.conf
EXPOSE 80 443 4000
CMD [ "nginx", "-g", "daemon off;" ]

(Warpman) #2

Simply replace the COPY statement by:
COPY --from=node /usr/src/app/dist /usr/share/nginx/html
and it will work.

Good Luck, Javier