Web-server and python interpreter in Docker Container

Docker :

Docker is a set of platform as a service products that use OS-level virtualization to deliver software in packages called containers. Containers are isolated from one another and bundle their own software, libraries and configuration files; they can communicate with each other through well-defined channels.

Docker Image :

A Docker image is an immutable (unchangeable) file that contains the source code, libraries, dependencies, tools, and other files needed for an application to run.

Apache httpd :

The Apache HTTP Server, colloquially called Apache, is a free and open-source cross-platform web server software, released under the terms of Apache License 2.0. Apache is developed and maintained by an open community of developers under the auspices of the Apache Software Foundation.

Python :

Python is an interpreted, high-level and general-purpose programming language. Python’s design philosophy emphasizes code readability with its notable use of significant indentation.

In this blog, we will see how , a Docker container is launched in RHEL8 ,then setting up Apache Web-server and Python interpreter

System Requirements:

  1. Internet connection of Device
  2. Your patience….

Lets see how we can do above task:

🟥Installing Docker in RHEL8 :

We are using VM booted with RHEL8 in Virtual Box…..

🔐To download docker we have to first of all setup the docker repo :

Checking repolist :

#yum repolist

Heading to conf file of yum :

#cd /etc/yum.repos.d
#vi docker.repo
baseurl = https://download.docker.com/linux/centos/
gpgcheck = 0

Installing docker-ce :

#yum install docker-ce --nobest

Installation done !!!!

Bravo ! you have completed first step…

Checking docker install or not :

#docker --version

Starting docker service :

#systemctl start docker
#systemctl enable docker
#systemctl status docker

Pulling centos latest image from dockerhub:

#docker pull centos:latest

Checking any container launched yet or not !

#docker ps

Launching container with CentOS image network same as host :
#docker run -it --name mywebospy --network host centos:latest

Installing net-tools as we are interested in knowing IP of conatiner:

#yum install net-tools

Knowing IP of container:


Now its turn to install APACHE HTTPD SERVER:

#yum install httpd -y

We dont have systemctl command in conatiner , so to start service we need to use :


Putting up webpage in document root of Apache server:

#cat > /var/www/html/index.html

IP of container is :


We don’t have GUI available right now, that is we need to check if the webserver is properly configured or not …

But we have curl command in RHEL8 which works as CLI browser…

#curl ip_of_conatiner:portno/index.html

Yipee! we have successfully setup Web-server in container

Installing python3 in conatiner:

#yum install python3


We are ready to write python scripts now….

🤗Happy learning …….

Stay tune for more interesting technological integration…..✈✈