Static site on Apache server from Docker

In this lab we learn how to host a static site running on Apache server hosted by Docker

  1. Create a Dockerfile

    FROM smebberson/alpine-apache
    ADD ./public-html/myindex.html /var/www/localhost/htdocs
  2. Create a directory public_html with the following content in myindex.html

    Hi There - Static page served by Apache Server
  3. Your directory should look like this

    $ tree .
    ├── Dockerfile
    └── public-html
        └── myindex.html
  4. Create a Docker image

    $ docker build -t my-apache2-alpine .

    This will create a my-apache2 image.

  5. Create a Docker Container running this image

    docker run  -p 80:80 --name my-apache2-alpine-1  my-apache2-alpine
  6. Open browser of the host at http://localhost:80, you will see the website up and running

  7. Open the browser at the following url to see your custom page http://localhost:80/myindex.html