Configuring HTTPD Server and setting up Python Interpreter and running Python Code on Docker Container

Configuring HTTPD Server and setting up Python Interpreter and running Python Code on Docker Container

Let’s understand few concepts related to this task

Why we use Docker?

Docker is a container management service. The whole idea of Docker is for developers to easily develop applications, ship them into containers which can then be deployed anywhere within few seconds.

  • This technology was created by Solomon Hykes,March 2013.
  • You can deploy Docker containers anywhere, on any physical and virtual machines and even on the cloud.

Since Docker containers are pretty lightweight, they are very easily scalable.

What is the use of Apache server? How it works?

  • The Apache HTTP Server Project is an effort to develop and maintain an open-source HTTP server for modern operating systems including UNIX and Windows. The goal of this project is to provide a secure, efficient and extensible server that provides HTTP services in sync with the current HTTP standards.
  • The Apache HTTP Server (“httpd”) was launched in 1995 and it has been the most popular web server on the Internet since April 1996.
  • While there’s a lot of complexity underpinning how a web server functions, the basic job of all web servers is to accept requests from clients (e.g. a visitor’s web browser) and then send the response to that request (e.g. the components of the page that a visitor wants to see).
  • Virtual hosting is one such feature that allows a single Apache Web Server to serve a number of different websites.

Let’s move towards our practical part:

Step 1: Start and run docker container

Command - docker run -it --name containername imagename

Step 2: Install httpd on container

Command- yum install httpd -y

No alt text provided for this image

Step 3: Install net-tools

Command- yum install net-tools -y

No alt text provided for this image

Step 4: Start httpd server

Command- /usr/sbin/httpd or httpd

No alt text provided for this image

Step 5: Check in which port httpd is running

Command- netstat -tnlp

No alt text provided for this image

Step 6: Create one html file.

No alt text provided for this image

Step 7: Check the ip of container

No alt text provided for this image

Step 8: Check whether the webpage is configured or not.

URL- https://C_IP/html_file_name

No alt text provided for this image

Hence, our httpd server is configured.

Now, Let's set up python interpreter on Docker

Step 1: Install python

Command- yum install python3 -y

No alt text provided for this image

Step 2: Type Command python3 for live interpreter.

No alt text provided for this image

Step 3: Creating and running python file

Command for running - python3 filename

No alt text provided for this image

Hence, Python Interpreter has also been set on docker.

Thanks for reading!!






GAURAV DESHMUKH

Former SDE Intern @Raja Software Labs, Pune

3 年

Great Explained !!!

Aniket Khadye

Site Reliability Engineer at Crest data systems

3 年

Great work

要查看或添加评论,请登录

社区洞察

其他会员也浏览了