Docker Part 2 Assignment - 2

Tasks To Be Performed:

  1. Use the Apache2 container created in previous module
  2. Create a bind mount on /var/www/html to replace html files dynamically

Submit the commands to complete the assignment.

Step 1:

Using container ID: cbda67fd188b from Assignment 1 โ€“ Docker โ€“ II

Removing container

docker rm -f cbda67fd188b

This command recreates a container with bind mounts, linking specific source and target paths from the local host to the container.

docker run -it --mount type=bind,source=/c/Users/Hecti/Desktop/docker_vol,target=/var/www/html -p 8080:80 -d hectorproko/my_docker_image:my_apache_image2


Step 2:

Created file /index.html inside folder nano docker_vol nano docker_vol/index.html

<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
 
<h1>Created in Bind Mount</h1>
 
 
</body>
</html>

Restarted the container

docker restart 0f3ceee8c91693

Verifying the the index.html is being hosted by accessing the container/Apache Server

Success