Configuring HTTPD Server and running Python code on Docker Container

Muskan Agarwala
3 min readMay 30, 2021

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.

  1. 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!!!!

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

No responses yet

Write a response