Configure Web Server and Setup Python Interpreter on Docker Container

Sweta Sardar
5 min readDec 2, 2020

Before start the above configurations first let me know you “What is Docker” ?

.Docker is known as Containerization Technology. It is a powerful tool designed to make it easier to create, deploy, and run applications by using containers.

.Docker enables you to ship isolated services as often as needed.

.The most important thing Docker is an open source project.

.Rather than creating a whole virtual operating system, Docker allows applications to use the same Linux kernel as the system that they’re running on and only requires applications be shipped with things not already running on the host computer.

.This gives a significant performance boost and reduces the size of the application.

.We can create “multiple” containers.

How to use Docker ?

To use Docker is not a big deal because it is so simple to use only few steps to do. But the major thing is you have to aware about your requirement that what you exactly want to do with this technology.

So let’s I’m going to show you the Docker set-up in RedHat Linux.

  1. First we have to download the Docker package repository from browser using “wget” command because in RHEL8 the Docker software is not available.

Command : wget https://download.docker.com/linux/centos/docker-ce.repo

2. Now install the Docker software using yum command.

Command : yum install docker-ce — nobest

3. Check the version.

Command : docker — version

4. Now we have to start the Docker Engine.

Command : systemctl start docker
Command : systemctl status docker

How to pull images on Docker ?

Docker images are are the starting point for anyone using Docker for the first time. A Docker image is made up of a collection of files that bundle together all the essentials, such as installations, application code and dependencies, required to configure a fully operational container environment. Each of the files that make up a Docker image is known as a layer. We can find the images from DOCKER HUB It contains many pre-build images so we can pull from it.

Command : docker pull image:version

We can pull any images like ubuntu, centos, redis many more as per our requirement and we also have to write the version of image, if we didn’t write the version, it will not occur any problem it’s just take latest version as default tag.

How to launch and run the Container on Docker ?

To launch the container we have required to run the container and give us one interface(-i) and one terminal(-t) to write our commands. We can also give our own name to the container. So we have to follow the simplest command which is —

Command : docker run -it — name <give_ur_cont_nm> <give_image_nm>:<version>

Our set-up is done Successfully. Now let’s jump to our Task :

🔰HOW TO CONFIGURE WEB SERVER ON DOCKER CONTAINER🔰

First we have to pull the image here I’m taking centos image as latest version :

Now we have to run and launch the container :

Now for configure the WEB SERVER we need to install the HTTPD Server :

Now we have to go to the document root(/var/www/html) folder and create one file for deploy the web page on the Web Server :

We can see here we have successfully launched our web page on the top of Web Server :

Now let’s setup Python Interpreter :

🔰SETUP PYTHON INTERPRETER ON DOCKER CONTAINER🔰

Step -1. Launch the docker container with any name here I’m taking pytest as a container name :

Step -2. Now install the python version 3 software :

So we have successfully installed the Python3 and here I’m tried one example to print the statement :

🔹 Thank You 🔹

🔹 !! HAPPY LEARNING !! 🔹

🔹 Keep sharing keep learning🔹

--

--