2

I am new to Docker and I want to start an Apache Server with Docker. But it shows the same Website, even if I delete the whole directory and creating a new one ...

My Dockerfile:

 FROM httpd:2.4
 COPY ./HTML/ ./htdocs/
 //in HTML/ are my html files ^^

In HTML/ is my ad.html:

<html>
   <head>
       <title>KRASS!</title>
   </head>
   <body>
       LDLALDLADAPjF<br/>djafijafija</br>auohf<br/>dddad
   </body>
</html>

And in docker I am doing it like it is shown here https://store.docker.com/images/httpd , but I am adding the -p

$ docker build -t my-apache2 .
$ docker run -dit -p 4000:80 --name my-running-app my-apache2

And like I said above, then I enter the page via my ID:4000, it just shows "It works!" which was the content of my first try

Celebrombore
  • 170
  • 11

1 Answers1

1

From the link you provided, it seems that the html files should be copied inside: /usr/local/apache2/htdocs/ and not: ./htdocs

How to use this image.

If you want to run a simple HTML server, add a simple Dockerfile to your project where public-html/ is the directory containing all your HTML.

Create a Dockerfile in your project

FROM httpd:2.4
COPY ./public-html/ /usr/local/apache2/htdocs/
tgogos
  • 23,218
  • 20
  • 96
  • 128