Build Docker image for PHP Web application - ADD failed

+1 vote
I have created a dockerfile with the base image devopsedu/webapp for PHP web application.

FROM devopsedu/webapp
ADD proj /var/www/html
RUN rm /var/www/html/index.html
CMD apachectl -D FOREGROUND

When I tried to build the docker image using dockerfile, it failed on step 2 indicated that "no such file or directory" error message.

edureka@server:$ docker build -t devopsedu/webapp:dockerfile .
Sending build context to Docker daemon  2.048kB
Step 1/4 : FROM devopsedu/webapp
 ---> 0ef91240e173
Step 2/4 : ADD proj /var/www/html
ADD failed: stat /var/lib/docker/tmp/docker-builder032612005/proj: no such file or directory
Jul 13 in Docker by limcw
• 270 points
110 views
Paths in your Dockerfile are not absolute paths on your filesystem, but relative to the build-context. Check if that is within the build context.

1 answer to this question.

+2 votes
Best answer
Thank you Sirajul

Yes, I have changed it to the absolute paths on my filesystem and it is working now.

FROM devopsedu/webapp
ADD website /var/www/html
RUN rm /var/www/html/index.html
CMD apachectl -D FOREGROUND
answered Jul 15 by limcw
• 270 points

selected Jul 16 by Vardhan
Glad to help! @limcw :)

Related Questions In Docker

0 votes
1 answer

build context for docker image very large

The Docker client sends the entire "build ...READ MORE

answered Aug 1, 2018 in Docker by Kalgi
• 41,820 points
3,775 views
0 votes
2 answers

How do I force Docker for a clean build of an image ?

You could try this inorder to clean ...READ MORE

answered Aug 6 in Docker by Sirajul
• 31,980 points
1,398 views
0 votes
1 answer

How do I delete the build cache for a docker image?

You could try this inorder to clean ...READ MORE

answered Jul 3 in Docker by Sirajul
• 31,980 points
218 views
0 votes
1 answer

build an J2EE application with docker

I would suggest you to use volume ...READ MORE

answered May 1, 2018 in Docker by shubham
• 6,890 points
48 views
0 votes
2 answers

How can I inspect the file system of a failed `docker build

Failed command is a build that has ...READ MORE

answered Aug 6, 2018 in Docker by Nilesh
• 6,880 points
93 views
0 votes
1 answer

Docker Swarm- Build image only when stack deployed from manager node

Use docker build to build the image. ...READ MORE

answered Aug 24, 2018 in Docker by Nilesh
• 6,880 points
52 views
0 votes
1 answer

How to run an image with volume on docker for windows?

Try : declaring the volume of container mounting the ...READ MORE

answered Sep 19, 2018 in Docker by Tyrion anex
• 8,270 points
48 views
0 votes
1 answer