Launching A Webserver & Python Interpreter On Docker Container

Launching A Webserver & Python Interpreter On Docker Container

!! ?????????? ?????????????????????? !!

? Welcome you all to my article based on TASK-7.2 of ARTH - The School Of Technologies ?

?? TASK DESCRIPTION:

?? Configuring HTTPD Server on Docker Container

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

?? What is Docker ?

Docker is an open platform for developing, shipping, and running applications. Docker enables you to separate your applications from your infrastructure so you can deliver software quickly. With Docker, you can manage your infrastructure in the same ways you manage your applications. By taking advantage of Docker’s methodologies for shipping, testing, and deploying code quickly, you can significantly reduce the delay between writing code and running it in production.

? The Docker platform

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!

? Docker provides tooling and a platform to manage the lifecycle of your containers:

  • Develop your application and its supporting components using containers.
  • The container becomes the unit for distributing and testing your application.
  • When you’re ready, deploy your application into your production environment, as a container or an orchestrated service. This works the same whether your production environment is a local data center, a cloud provider, or a hybrid of the two.

?? TASK COMPLETION:

? To Use Docker Tool we have to Install the Docker Software .To Install Docker Software in RHEL8 Use the command as :

dnf install docker-ce --nobest 

?? After Installing Docker Now we are Ready to Perform the TASK .

1) We have to Configure the HTTPD Server Inside Docker Container . For that we have to first launch one Docker Container . In my case I have used CentOS Image for Docker Container .

?? To launch any Docker Container Docker has Command as :

docker run -{options} --name {name_of_container} {image_name}

?? To Download the Docker Image used for the Container Docker has Command as :

docker  pull  {image_name}

?We are now launching the Docker Container of CentOS Image by Running the Command as:

No alt text provided for this image

?? The above command includes the options as :

1) -i option creates the Interactive Connection with Container .

2) -t option creates a Terminal inside Docker Container .

3) -p option maps the host's 80 port with 9091 port of Docker Container . As we mapped the host's 80 Port with 9091 Port of Docker Container In order to Use the Public IP of Host Machine along with 9091 Port No of Container which forwards these requests to Apache webserver running on Port No 80 Inside Docker Container .

2) Now after Creating Docker Container we have to Install HTTPD Package for Configuring Webserver .

yum install httpd -y
No alt text provided for this image

3) To check the status of any service in Linux we normally use systemctl command .But Inside Docker Container by default some commands are not configured .For these to check the status of HTTPD Service just type httpd which shows the status of that service .

No alt text provided for this image

We can see that the status shows that HTTPD Services are Running .

4) Finally the Webserver is successfully configured inside Container . To test the Webserver let's write simple html code inside Document Root /var/www/html of Apache Webserver .

?? Integrating Docker with AWS Cloud ??

??In my code I have One Image to Display for that I Use AWS CDN Services which gives High Availability and Connectivity to the web page .

?? What is AWS S3 & Cloud Front Services ?

? To know more visit my Article ? Link Given Below:

https://www.dhirubhai.net/pulse/designing-high-availability-architecture-aws-s3-cloudfront-onkar-naik

?? Putting the Web Code Image inside AWS S3 Bucket -->

No alt text provided for this image

?? Creating Cloud Front Distribution for the Image Inside S3 Bucket -->

No alt text provided for this image

5) Finally just keep that URL Provided by Cloud Front for the Image Content inside html code . Now our static content in the webpage is high in terms of Availability and connectivity .

No alt text provided for this image

6) Now let's check the Apache webserver is configured well or not . To access the Apache Webserver content inside Docker Container we have to use <public_ip of host>:9091.

We can see the Home Page of Apache webserver means We have successfully configured the Webserver .

No alt text provided for this image

?? Accessing the Web Page --->

No alt text provided for this image

7) Now we have to Launch Python Interpreter Inside the Docker Container . For that we require Python software to be Installed in our system .

?? Installing Python3 Inside Docker Container --->

yum install python3 
No alt text provided for this image

8) At last we have to Run simple python code on the top of Docker . For that I have used Python3 REPL Live Interpreter to run System Commands of Docker Container by Importing OS module in Python3 .

No alt text provided for this image

?? In these way I successfully completed the TASK-7.2 of ARTH - The School Of Technologies.

? I would like to thanks Mr.Vimal Daga for giving us Right Approach towards the meaning of Technologies which helps to explore my skills in DevOps World .

!! Thanking you all for visiting my article !!

?? Keep Sharing Keep Learning ??











Priyanka Hajare

DevOps Engineer || Python || Docker || Ansible || Kubernetes || AWS || Jenkins || Buildkite || GoCD || GIT || GITHUB ||

4 年

Great job

Anushka Visapure

Solution-Oriented DevOps Engineer || Skilled in Kubernetes | Terraform | Ansible | Docker | Git and GitHub | GitHub Action || Expanding Capabilities in AWS | GCP | Linux.

4 年

Well explained ??Onkar Naik

回复
Ninad Deogaonkar

SDE-I at Hewlett Packard Enterprise

4 年

Well done

Deepak Shah

Terraform || Openshift(EX180) || AWS(CLF-CO2) || AWS(SAA-C03) Certified

4 年

Nice article ???

Nilesh Gopale

MTS 1 @Cohesity | Ex-Veritas | Kubernetes | Docker | Golang | Python

4 年

Good job Onkar Naik ????

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

Onkar Naik的更多文章

其他会员也浏览了