DOCKERFILE - PHP WEBSITE

+2 votes

I've pulled the devopsedu/webapp image from docker hub and create an image of out it. 
Now I want to add the PHP website to it and run them in a container. 

I made a dockerfile which is pulling the image and copying PHP code to the machine, but I saw that it's a wrong method, because the dockerfile should contain : 

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

which is not working at all, because I'm getting an error:

ADD failed: stat /var/lib/docker/tmp/docker-builder021352947/website: no such file or directory

My question is: why the dockerfile is looking so weird? From where it pulls the phpcode:https://github.com/edureka-devops/projCert

Oct 9 in DevOps & Agile by Mateusz
• 170 points

edited Oct 10 by Kalgi 132 views
Do you by any chance have a .dockerignore file? This file might be ignoring the tmp folder.
no i don't have it
Can you show your directory structure?

1 answer to this question.

+1 vote

Here's the Reason why your dockerfile is structured that way.

You have to create a dockerfile and the base image should be devopsedu/webapp. And you have to write dockerfile in such a way that it should run the PHP application. 

The below sample docker file which uses devopssedu/webapp as the base image and then it runs the PHP application. 

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

/var/www/html is the directory where your website files are stored. These files include the codes, images etc used for the website.

The application code is moved or copied inside the container and a docker image is build. An image is created. 

Now when you run this image, the php application will get executed.

answered Oct 10 by Karan
• 6,670 points
ok now i get this that means the "proj" word in my Dockerfile is the path to the php code etc which is move the /var/www/html folder right ?

Anyway i'm stil getting the same error
Try using relative paths. Recently even I have been facing the same error while using the absolute path.

Related Questions In DevOps & Agile

+1 vote
2 answers

Scp Php files into server using gradle

Tru something like this: plugins { id ...READ MORE

answered Oct 11, 2018 in DevOps & Agile by lina
• 8,160 points
123 views
0 votes
1 answer

High availability (HA) website load balanced across both Azure and AWS?

DNS load balancing is the practice of ...READ MORE

answered Jul 6, 2018 in DevOps & Agile by Kalgi
• 45,910 points
35 views
+1 vote
1 answer

Isolate PHP applications with Docker

That is the idea: you can make ...READ MORE

answered Jul 12, 2018 in DevOps & Agile by Kalgi
• 2,620 points
43 views
0 votes
1 answer
0 votes
1 answer

How to give a name to an image in Dockerfile ?

This needs to be done in your ...READ MORE

answered Nov 16, 2018 in DevOps & Agile by Damon Salvatore
• 5,510 points
117 views
0 votes
1 answer
0 votes
1 answer

Running docker-compose on a docker gitlab-ci-multi-runner

The problem (as I understand it) is ...READ MORE

answered Aug 2, 2018 in Docker by Kalgi
• 45,910 points
431 views
+13 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 26, 2018 in DevOps & Agile by DragonLord999
• 8,380 points
252 views
+1 vote
1 answer

Devops certification project: Dockerfile and PHP website

Try using relative paths. Recently, even I ...READ MORE

answered Nov 14 in Docker by Eric
75 views