Module 3: Docker Part 1 Assignment - 1
Training Tasks To Be Performed:
- Pull Ubuntu container
- Run this container and map port 80 on the local
- Install Apache2 on this container
- Check if you are able to access the Apache page on your browser
Prerequisite:
Before I begin with the Docker tasks, I’ve ensured that:
- I have Docker Desktop installed on my Windows machine.
- I’ll be running all the Docker commands in cmd.
- I pull the Ubuntu container.
docker pull ubuntu
- I run the Ubuntu container and map port 80 on my local machine to port 80 on the container.
Note to myself: Before mapping port 80, I ensure that no other services are using it on my host machine to avoid conflicts. If there are issues, I’ll address those first.
docker run -it -p 80:80 ubuntu
Once executed, I am inside the container's shell.
- I install Apache2 on this container. First, I update the package lists:
apt update -y --fix-missing
Then, I install the Apache2 package:
apt install apache2 -y
- I start the Apache2 service inside the container.
service apache2 start
To ensure Apache2 is actively running, I check its status:
service apache2 status
- I open my web browser to access the Apache2 default page.**
Success
By navigating to
http://localhost
, I see the Apache2 Ubuntu default page.