Build yur own web server image and copy the document root into the image

Note

Clone the git repository if you haven’t done it yet.

Go to Project 2 from the git repository root:

cd projects/p02

Project structure:

.
├── Dockerfile
└── www
    └── index.html

The content of the html file

Hello Docker (p02)

and the Dockerfile

FROM httpd:2.4

LABEL hu.itsziget.ld.project=p02

COPY www /usr/local/apache2/htdocs

Building an image:

docker build -t localhost/p02_httpd .

The dot character at the and of the line is important and required.

Start container:

docker run -d --name p02_httpd -p "80:80" localhost/p02_httpd

You can open the website from a web browser on port 80. The output should be “Hello Docker (p02)”

Delete the container to make port 8080 free again.

docker rm -f p02_httpd