How to configure webserver and python interpreter on the top of Docker

How to configure webserver and python interpreter on the top of Docker

Docker:

Docker provides the ability to package and run an application in a loosely isolated environment called a container. The isolation and security allow you to run many containers simultaneously on a given host. Containers are lightweight because they don’t need the extra load of a hypervisor, but run directly within the host machine’s kernel. This means you can run more containers on a given hardware combination than if you were using virtual machines. You can even run Docker containers within host machines that are actually virtual machines.

Webserver:

 A web server is a computer that runs websites. It's a computer program that distributes web pages as they are requisitioned. The basic objective of the web server is to store, process and deliver web pages to the users. This intercommunication is done using Hypertext Transfer Protocol (HTTP). These web pages are mostly static content that includes HTML documents, images, style sheets, test etc. Apart from HTTP, a web server also supports SMTP (Simple Mail transfer Protocol) and FTP (File Transfer Protocol) protocol for emailing and for file transfer and storage.

Description of task:

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

Solution:

step1:

To install docker in our RHEL8 OS, we have to use the given command:

yum install docker-ce --nobest

step2:

After installing docker, we need to pull the docker images by using the given command. In this task we used the centos.

docker pull centos
No alt text provided for this image

step3:

Now we launch the docker container by using given command:

docker run -it — name=mywebserver centos
No alt text provided for this image

step4:

To configure webserver, we have to install httpd package in our docker conatiner.

No alt text provided for this image
No alt text provided for this image
No alt text provided for this image

step5:

Now we create a file with extension .html in the /var/www/html folder by using following commands:

cd /var/www/html


vi index.html


No alt text provided for this image

step6:

Now we use the given command to enable the httpd service.

 /usr/sbin/httpd
No alt text provided for this image

step7: 

Now to check the ip address, we have to install the net-tools package by using given command:

yum install net-tools -y
No alt text provided for this image

We use the given command to check ip address.

ip addr

No alt text provided for this image

step8:

Now our webserver is working as we can see in the below image.

No alt text provided for this image

step9:

To run python code in our docker container, we have to install python package by using given command:

yum install python3
No alt text provided for this image
No alt text provided for this image

step10:

After installing python3, we can run python code as we can see in the below image.

No alt text provided for this image

Thankyou for the reading!!

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

Rittik Gupta的更多文章

  • Neural Network and its use case

    Neural Network and its use case

    Neural Network: A neural network is a system designed to act like a human brain. It’s pretty simple but prevalent in…

  • Jenkins and its use case

    Jenkins and its use case

    Jenkins: Jenkins is a free and open source automation server. It helps automate the parts of software development…

  • AMAZON SQS USE CASE

    AMAZON SQS USE CASE

    AMAZON SQS: Amazon Simple Queue Service(SQS) is a managed message queue service offered by Amazon Web Services (AWS)…

  • Kubernetes and its use cases

    Kubernetes and its use cases

    Kubernetes: Kubernetes is an open source platform for deploying and managing containers. It provides a container…

  • AWS Command Line Interface

    AWS Command Line Interface

    The AWS Command Line Interface (CLI) is a unified tool to manage your AWS services. With just one tool to download and…

    2 条评论
  • How IBM uses Big Data

    How IBM uses Big Data

    Big Data: Big Data describes the large volume of data in a structured and unstructured manner. The data belongs to a…

  • How Disney+Hotstar uses AWS Cloud

    How Disney+Hotstar uses AWS Cloud

    Amazon Web Services: Amazon Web services is one the most popular cloud service provider in the world. Services of…

  • How You Tube uses Artificial Intelligence And Machine Learning

    How You Tube uses Artificial Intelligence And Machine Learning

    ARTIFICIAL INTELLIGENCE: Artificial intelligence (AI) refers to the simulation of human intelligence in machines that…

  • Deploy the WordPress Application on Kubernetes and RDS services of AWS using Terraform

    Deploy the WordPress Application on Kubernetes and RDS services of AWS using Terraform

    Amazon Relational Database Service (RDS): Amazon Relational Database Service (Amazon RDS) makes it easy to set up…

  • Developing WordPress and MySQL infrastructure with NAT gateway using Terraform

    Developing WordPress and MySQL infrastructure with NAT gateway using Terraform

    NAT gateways(Network Address Translation): NAT Gateway is a highly available AWS managed service that makes it easy to…

社区洞察

其他会员也浏览了