I’m creating simple React app with Docker image but for some reason I keep getting the following error:
COPY failed: file not found in build context or excluded by .dockerignore: stat build: file does not exist
Here’s the dockerfile:
FROM /httpd:2.4.38
ENV SRVROOT=/usr/local/apache2
ENV myapp=$SRVROOT/myapp
COPY /app/build $myapp
COPY /Docker/run.sh $SRVROOT
COPY /Docker/httpd.conf $SRVROOT/conf/
RUN chmod 755 $SRVROOT/run.sh
CMD ["/usr/local/apache2/run.sh"]
3
Answers
The
--from
flag is used formulti-stage
builds. It does not look like this is your case. Try removing the--from
flag from yourdockerfile
The first argument to COPY is the location of the file on the host machine. The leading slash means you’re trying to copy from
/app
and/Dockerfile
(at the root of your computer), which is outside Docker context. Those files should be relative to the current directory:Try using their relative path for the files you want to copy
Thanks