Skip to content
This repository has been archived by the owner on Feb 22, 2022. It is now read-only.

Latest commit

 

History

History
40 lines (29 loc) · 1.59 KB

ex_03.md

File metadata and controls

40 lines (29 loc) · 1.59 KB

Exercise 03

If you are using Windows, install GitBash from http://gitforwindows.org/. On the other hand, if using Mac/Linux, just use the existing Bash terminal.

By only using the Bash terminal, create a new folder where you copy over your solution of the previous exercise, i.e. the lesson02_solution.html file. Change the name of the file into index.html. You will likely need to use Bash commands like pwd, cd, mkdir, ls, mv and cp.

If you do not have it yet, install Docker (Community Edition) on your machine (e.g., see https://www.docker.com/community-edition#/download). If you are using Windows Home Edition, you might need to upgrade it first (e.g., to Educational or Pro version). If you are a student at Westerdals/Kristiania, you should be able to get free Windows upgrades.

In the newly created folder with the html file, create a file called Dockerfile by using touch. Open such file in a text editor. In such Dockerfile, configure it to use OS image from httpd:2.4. This image contains an Apache Server. Inside this Docker image, COPY your index.html file under the folder /usr/local/apache2/htdocs/.

From the folder with the Dockerfile, build this Docker image with:

docker build -t foo .

Run such Docker image with:

docker run -p 80:80 foo

If everything is correct, you should be able to open your browser at the URL localhost and see your html page.

Regarding Docker, solutions (i.e., the Dockerfile) to this exercise can be found under the solutions/03 folder.