Reputation: 83
I have the docker file as follows:
FROM node:8 as builder
WORKDIR /usr/src/app
COPY ./src/register_form/package*.json .
RUN npm install
COPY ./src/register_form .
RUN yarn build
FROM tensorflow/tensorflow:1.10.0-gpu-py3
COPY --from=builder /usr/src/app/register_form/build/index.html /app/src/
WORKDIR /app
ENTRYPOINT ["python3"]
CMD ["/app/src/main.pyc"]
However, it cannot copy the index.html from the builder stage. Although when I list the folder in the first stage, the files are there.
The error is:
Step 8/22 : COPY --from=builder ./register_form/build/ /app/src/
COPY failed: stat /var/lib/docker/overlay2/5470e05501898502b3aa437639f975ca3e4bfb5a1e897281e62e07ab89866304/merged/register_form/build: no such file or directory
How can I fix this problem - the COPY --from=builder docker command?
Upvotes: 1
Views: 5544
Reputation: 8646
I think you are misusing COPY
command. As it is told in docs:
If
src
is a directory, the entire contents of the directory are copied, including filesystem metadata.Note: The directory itself is not copied, just its contents.
So your command COPY ./src/register_form .
does NOT create register_form
folder in container, but instead copies all contents. You can try adding:
RUN ls .
to your Dockerfile
to make sure.
As noticed by @BMitch in comments, you can explicitly set destination folder name to achieve expected results:
COPY ./src/register_form/ register_form/
Upvotes: 2