Configuring the webserver and setting up python environment on the top of Docker Container

Configuring the webserver and setting up python environment on the top of Docker Container

?Task Description-:

??7.2: Docker Task

?Configuring HTTPD Server on Docker Container

?Setting up Python Interpreter and running Python Code on Docker Container.

??Why Docker ?

~ Developers bring their ideas to life with Docker ~

Docker is a set of platform as a service (PaaS) 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. All containers are run by a single operating system kernel and therefore use fewer resources than virtual machines. The service has both free and premium tiers. The software that hosts the containers is called Docker Engine

No alt text provided for this image


In 2013, Docker introduced what would become the industry standard for containers. Containers are a standardized unit of software that allows developers to isolate their app from its environment, solving the “it works on my machine” headache. For millions of developers today, Docker is the de facto standard to build and share containerized apps - from desktop, to the cloud. We are building on our unique connected experience from code to cloud for developers and developer teams.

??What is Apache Webserver?

Apache is a popular open-source, cross-platform web server that is, by the numbers, the most popular web server in existence. It’s actively maintained by the Apache Software Foundation.

Some high-profile companies using Apache include Cisco, IBM, Salesforce, General Electric, Adobe, VMware, Xerox, LinkedIn, Facebook, Hewlett-Packard, AT&T, Siemens, eBay, and many more (source).

No alt text provided for this image


In addition to its popularity, it’s also one of the oldest web servers, with its first release all the way back in 1995. Like other web servers, Apache powers the behind-the-scenes aspects of serving your website’s files to visitors.

Because Apache doesn’t perform as well in some benchmarks, especially for static websites or websites with high traffic, Kinsta uses the NGINX web server instead of Apache. Though NGINX hasn’t been around for as long as Apache, it’s quickly grown in popularity and market share since its launch in 2004.

??About Task -In this task we will install docker in RHEL8 Linux O.S and after installing docker we have to launch a container and inside that container we will configure Apache Web Server and Python3 .Also we will deploy a basic html page to check whether our web server configured or not and run python basic commands to check whether it is installed successfully.

STEP-1: Install Docker in RHEL8

  • Use yum command and to install any software via yum we have to first configure a yum repository.
No alt text provided for this image
  • after configuring the docker.repo , we will now install docker by using the below command:-
yum install docker-ce --nobest


No alt text provided for this image
  • To start and check docker services use following commands :
systemctl start docker
systemctl status docker 
No alt text provided for this image

STEP-2: After installing docker we will download docker image to launch our container.

  • we will use the below command:-
  • docker pull <image_name_here>
docker pull centos:latest           //To download docker image

docker run -i -t --name task centos //To launch a new os by using docker centos image

as soon as we will run the above command a new container O.S will launch {isolated OS}

No alt text provided for this image
docker ps      //this command is used to check any container is running or not

STEP-3:- Configure Apache Web Server on docker container :

yum install httpd -y        //To install apache webserver
No alt text provided for this image

To start httpd services "systemctl start httpd" will not work so used the following commands

/usr/sbin/httpd       //To start httpd services

netstat -tnlp         //Active internet connections

No alt text provided for this image

Step 4:- Go to the /var/www/html and create a simple html page (ex-index.html)

No alt text provided for this image
curl <ip>
eg.-curl 172.10.0.2     //to check the output using ip 

No alt text provided for this image
  • Successfully configured the apache webserver . . .

STEP 5:- Setting up python environment on top of docker container

yum install python3             //command to install python
No alt text provided for this image

Python has been successfully installed . . .


THANKS FOR READING . . .

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

Ishana D.的更多文章

社区洞察

其他会员也浏览了