Configuring HTTPD Server and Setting up Python Interpreter and running Python Code on Docker Container
We all know the container technology and one of them is Docker which is base on container technology so first let me tell you what is docker is a one of the famous container base technology in which we can install ,boot, start OS in just 1 sec which saves our time and also it launch a whole new OS in just 10-30 mb of RAM which help us for less consumption of the recourses by which we can launch as many as OS in one system without hesitation .
So here I am using one of the OS from docker to launch the Webserver and python interpreter name as CentOS it is a downstream of the Redhat os all features of the Redhat are available in it.
so lets begin...
Task Overview
7.2: Docker Task
🔅Configuring HTTPD Server on Docker Container
🔅Setting up Python Interpreter and running Python Code on Docker Container
so lets start ....
Step 1:- Download centos image in docker container using command
#docker pull centos
Step 2:- lets start our centos using command
#docker run -it --name webserver centos:latest
here instead of webserver you can give any name it is consider as os name.
Step 3:-lets check have we landed to our new os or not using command
# ifconfig
you can see the change in ip of your base os and new os in docker.
Step 4:- you will see and error while using above command that not found it is not an error it says that the program which contain ifconfig command is not installed in your os so lets install it first using command
#yum install net-tools
now we can use the ifconfig command
Step 5:- lets start the python interpreter
# python3
again you see that python3 not found because it is not their to check whether it is install or not we have one command in centos
# rpm -q python3
from the above commad we can check whether the command is their or not
after that we install the python on docker using command
# yum install python3
Step 6:- Lets try to execute python program in interpretor
Lets try to configure webserver
Step 1:- Lets configure Webserver on docker using command
# yum install httpd
Step 2:- Lets write a html code in html file for this we need to write our code in file /var/www/html/ change the directory and create file in it with .html
Step 3:-As centos is downstream project of Redhat we can use all command but to start webserver in centos in docker we use command
# /usr/sbin/httpd/
It start the Server as it doesnt support systemctl start httpd
Step 4:- To check the status of Webserver
# netstat -tnlp
As it not support the commad systemctl status httpd
By this way we can configure Apache Webserver on Docker and we can use it also we can install and use pyhon3 interpreter on it...
Hope you like it......
Thank you😊😊😊
Always Welcome for suggestions....
Nice one ✌🏻✌🏻🔥🔥