Configuring HTTPD Server and running Python code on Docker Container…

What is Docker?

A Docker container image is a 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:

How to install Docker on Linux OS (RHEL 8)?

→First go inside the yum repo directory using the cmd,

cd /etc/yum.repos.d/

→Then create a filename called docker.repo and write the following lines,

[docker]

baseurl=https://download.docker.com/linux/centos/7/x86_64/stable

gpgcheck=0

→ Then run the yum repolist command to check that your docker repo is successfully created and configured.

STEP 2:

yum install docker-ce --nobest -y

The best possible version (by using nobest) of docker has been successfully installed!!! We can run docker --version cmd in order to confirm the successful installation.

STEP 3:

Start the Docker Service in your base OS

systemctl start docker

Check the status (active/inactive) by using systemctl status docker

Launching Docker OS

In order to use Docker OS, we need to pull a Docker image,

docker pull centos

docker images

docker run -it — name webserver centos:latest

Now we are inside our Docker OS (Centos)!

Configuring Apache server on top of Container

STEP 1:

yum install httpd

STEP 2:

Go inside /var/www/html using cd cmd, and create a file and put some content..

→ Now we need to start httpd service and for that we need to use the following command since systemctl start httpd doesn’t work in container OS

/usr/sbin/httpd

Service has been successfully started!!

Configuring httpd on docker is Successfull!!!

PART 2: Setting up python interpreter and running a python code!

STEP 1:

yum install pyhton3

Python Successfully installed!!!

STEP 2:

You can either run the Python interpretor by using python3 cmd or create a small .py file run python3 filename.py.. In either way your python code is successfully running on your docker container!!!

Conclusion:

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

--

--

--

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

TERPERCAYA Wa 0822-11-666-551, Pengadaan Pompa Sentrifugal Apartment Di Surabaya

QuickSilk — the best CMS for non-profits

How to build unbelievable web applications with Go

I am getting cheaper pricing for hosting from other providers. Why is your price high?

The Story of jOeCHEM

What is the main difference between SQL and NOSQL ?

How to manage Part Numbers in openBoM

Patterns for Microservice interactions: Command, Query and Event

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Sangeeth Sahana D

Sangeeth Sahana D

More from Medium

Python GUI frameworks

Python — Twitterbot Series, Chapter 1: Automating interactions via REST API

How To Enforce Conventional Commit Messages Using GIT Hooks

GUI APPLICATION INSIDE DOCKER CONTAINER