Task 7.2. (A and B): Docker Task:
š 7.2: Docker Task
š
Configuring HTTPD Server on Docker Container
š
Setting up Python Interpreter and running
Python Code on Docker Container
1.Configuring HTTPD Server on Docker Container
For this we need to follow some steps
Sub-task 1:
- Configure yum repository in order to install docker
- Install docker-ce in the host-OS
- Start the docker services
Sub-Task 2:
- Pull a centos image from the docker repository
- Launch a centos container
- Install httpd software in the container
- Start the services
- Test the services are working or not
- Put the web content on the web server
- Test the services
Sub-Task 3:
- Install python3 in the container
- Launch the python interpreter to run python functions and commands
Sub-task 1:
In order to install the docker we are going to use the yum (you can also use dnf) to install docker
Yum or dnf is command in linux we can use to install any software it also installs any dependencies regarding the software for the user
But to install using yum or dnf we need to tell them from where they need to install the software. Typically we need to set the repository. They can actually download and install software from file, folder and url as well.

Now we need to install docker-ce by using below cmd

Now we need to start the docker services in the base os. Using the command
#systemctl start docker
Sub-task 2:
- Now install the image on dockee to run the container.
#docker pull centos
By default it pull the latest centos image from the docker hub

- Now run the container on top of docker
#docker run -itāāāname MyWebOS centos:latest

- First install the httpd service on the CentOS container

#yum install httpd
- Install the net-tools package. Because in CentOS ifconfig cmd is not working so to use this cmd and to get our CentOS containerās IP we need to install net-tools.

Now we can use the ifconfig cmd:

- Now put the web content inside docker.html file inside /var/www/html folder

- docker.html file contains:

- Next we need to start httpd web server Now the challenge is systemctl command doesnāt work in docker container. But we know behind the seen systemctl run a file /usr/lib/systemd/system/httpd.service and in that the service is started using /usr/sbin/httpd/
So use below cmd to start the httpd service

Now in the browser we can see our service is running perfectly.

Sub-task 3:
- Install the python3 software inside container

- Now run the python interpreter

So, TASK COMPLETED.
Thank you friends for reading my articleāļøšš