HTTPD server and Python interpreter on Docker Container.😎

Upmanyu Sharma
3 min readNov 22, 2020

In this article, We are going to learn how to configure HTTPD server and setting up a python interpreter, and running Python Code on Docker Container.

You must ensure you have docker installed on your Virtual Machine or Instance.

Start the docker services and Check the status to confirm.

Let us start with configuration of httpd server

Now let us run any OS lets say centos:7 using docker

Command: docker run –it –name mynewos1 centos:7

We have to install httpd package using the command:

yum install httpd

How to solve this problem?

systemctl start httpd is not working, so we have to provide the path to httpd.

which <command> provides the full path of the command in the prompt

But you can see which command not found in Centos:7 container.

We need to install its package using yum.

yum install which

So finally we have got the full path of httpd.

Run the command: /usr/sbin/httpd which will start the web service.

Now create your html website in the directory /var/www/html.

Now, we require the IP address of the container to open the website in brwoser.

We need to install the package net-tools for ifconfig command.

So finally net-tools package is installed. Now we have to obtain the IP address of our docker container using command: ifconfig

Here We can see the website in the browser by writing IP address followed by html file name.

Now Let us Start with another scenario in which we have to configure Python Interpreter on Docker Container.

Python Interpreter on Docker Container

Let us run any OS lets say centos:7 using docker.

We have to install python3 package using yum.

So, python3 package is installed successfully.

Let us create a Python file to check the intrepreter.

Here, you can see python interpreter is working propertly.

So finally the task is completed successfully.

Thank you for reading my article. 🙂

--

--