Deploying Web Server and setting up Python Environment on the Docker Container.

🔘Goal for this blog:

🔅Configuring HTTPD Server on Docker Container

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

So Let’s Start

🔅Configuring HTTPD Server on Docker Container:

I am going to launch an ec2 instance on AWS cloud on the top of which we are going to install the docker

I have successfully login to our instance using Putty.

Now i am going configure yum repository for installing the docker-ce, to do this first i have to go /etc/yum.repos.d directory, then i have to create a file with .repo extension .

Here in my case i have created docker.repo file in which i have written the following things:

Now we have successfully configured the repo for docker, to install the docker we have to write the command :

#yum install docker-ce — nobest

Now docker is successfully installed on the top of ec2 instance.

to check this we have #rpm -q docker-ce command

Now we have to start the docker service using systemctl command:

#systemctl start docker

Next step is to download the docker image of Centos OS:

Now to pull the image we have the command:

#docker pull <image name>

Next Step is to Launch the container:

for this we have the command;

# docker run -it — name webserver centos:latest

ifconfig command doesn’t pre-installed here. So we can ask yum that which software provides us ifconfig command :

So we need to install the net-tools software to use ifconfig command.

we can run ifconfig command to know our IP address.

🔴To Configure Apache httpd webserver on docker container we have to follow certain steps :

1️⃣Install httpd software

2️⃣Put the webpages in /var/www/html

3️⃣Start the Service

Step-1: Install httpd software

To install httpd software, run #yum install httpd command inside the docker container.

Step-2:Put the webpages in /var/www/html

we have created an html file web.html

Step-6: Start the HTTPD Service

Normally to start the service we always use systemctl start httpd command. But in docker container by-default systemctl command doesn’t work. Here to start the service we use /usr/sbin/httpd

To check that we have successfully started the service, we can run the command #netstat -tnlp if it shows port 80 then the service is started.

🔅Setting up Python Interpreter and running Python Code on Docker Container:

To setup Python Interpreter we have to install python3 in the container, for this we have the command :

#yum install python3

Now we can run the any python code on the system by run command



For any Query ping me on the LinkedIn:

Connect with my mentor: Mr. Vimal Daga

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Deploying 5G Core Network with Open5GS and UERANSIM

ACROSS AMERICA — The lunar spectacular occurring next week is a bit of a mouthful: It’s a super…

[Kducato 2nd Voting Event] Winner Announcement for Day 6

How we moved 6 Million Users from Auth0 to Firebase

Apollo server caching : Getting it right

To the moon and back, that’s how it should be !

#WebVR @ MozNirma

TDD Vs BDD: What’s the difference between TDD vs BDD?

3-D Printed Robotic Arm

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Raj Kumar Vishwakarma

Raj Kumar Vishwakarma

More from Medium

Docker Compose with AWS ECS Fargate: overview of (subtle) limitations

Docker for beginners

Configure Multi Node Airflow Architecture Using Docker Compose

How to Set-up Airflow Environment Using Docker