Lab 2
Create Directories
mkdir -p lab2/html
mkdir -p lab2/conf
We will now copy our index.html and web.conf files from Lab1 to this project. cp
is the Linux copy command and works as such:
cp source destination
. Using the trailing .
in our destination lets Linux know we want to use the same name as the source.
cp lab1/index.html lab2/html/.
cp lab1/web.conf lab2/conf/.
Attach Volume to Container
docker run -p 81:80 -v ~/lab2/conf:/etc/nginx/conf.d/web.conf -v ~/lab2/html:/usr/share/nginx/html --name docweb -dit nginx
Validate the site is working
docker ps -a
Navigate to
Now, lets go to your index.html file in lab2/html/index.html and alter some text like highlighted below.
<html>
<head>
<title> TEST SITE</title>
</head>
<body>
Lab 2
<p>Demo site for training.</p>
</body>
</html>
Once your change is made, you should be able to reload your page by either Cntrl r or CMD r and observe your code update.