Configuring HTTPD Server and running Python code on Docker Container

What is Docker?
Docker is a software platform for building applications based on containers. Docker Containers are lightweight, standalone, executable package of software that includes everything needed to run an application: code, runtime, system tools, system libraries and settings, that makes it efficient in terms of space as well as time.
PART 1: Configuring HTTPD server on Docker Container
Step-1: Create Docker.repo.
- Open your terminal and run the command
cd /etc/yum.repos.d/

2.Create a filename called docker.repo
vi docker.repo

3.write the following lines in the file

Step-2:Install Docker
yum install docker-ce — nobest -y

5.To check the status use-
systemctl status docker

6.Docker service is not active so, let’s start the service of Docker For a temporary start (stop service after reboot) we use…
systemctl start docker
For a permanent start (services never stop even reboot) we use …
systemctl enable docker

Step-3:Pull image
Pull the required image to create a docker container.
docker pull centos:latest

Step-4: Run the container
docker run -it — name webserver centos:latest

Step-5:install HTTPd webserver
yum install httpd net-tools -y

After successfully installed we need to start httpd service.
/usr/sbin/httpd

PART 2:Setting up Python Interpreter and run Python Code on Docker Container
Step-1:we need to install a python interpreter
yum install python3

Step-2: Now created a python program of addition for test & run it.

We’ve successfully installed docker, configured HTTPD service on top of docker and finally set up the python interpreter and got the output by running a simple python code!!!!