Creating a Webapp Environment in Docker Container by Setting up an HTTP Web server and Python…

Creating a Webapp Environment in Docker Container by Setting up an HTTP Web server and Python…

January 1, 20232 min readSri VishnuvardhanSri Vishnuvardhan

A web application is application software that runs on a web server, unlike computer-based software programs that are run locally on the operating system of the device.

For the Web app, it needs an environment that cannot be compromised. In this article, we are going to see how to create an environment for running a Webapp in Container with Virtual Machine as a host. Here we used Oracle VirtualBox’s RHEL8 Virtual Machine is acting as a host.

Contents:

  • Docker Installation
  • Configuration of HTTP Server
  • Python Interpreter setup

Docker Installation

Docker is a set of platform as a service 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. The installation consists of below steps.

  • Yum Configuration
  • Service Installation
  • Starting Service
  • Permanently Enabling

Yum Configuration

First step is to configure the yum so that we can configure Docker.

Second step is to install the Docker by using the command given below.

dnf install docker-ce --nobest

Third step is to start the service.

systemctl start docker

Then we have to make this service permanent after every reboot.

systemctl enable docker

Then you have to launch the container, but launching container needs Docker images. Here, we will use Centos image. We will download the image using the command shown below.

docker pull centos

Then we have to launch the container by using below command.

docker run -it --name mycentos -p 1234:80 centos

After running this command, we will go inside the container. You can verify it by seeing the change in hostname.

Configuring HTTP Server

Configuration inside docker container requires three steps namely Installing Package, Start the service and Make it Permanent.

You can install the HTTP server by using yum.

yum install httpd -y

Then you have to start the server inside the container by using the command shown below.

/usr/sbin/httpd

Then you have to make this service permanent by copying “/usr/sbin/httpd” inside the /etc/.bashrc file.

Python Interpreter setup

Final step is to setup the Python interpreter, because we can create a webapp using Python. You can install this setup by running the command shown below.

yum install python3 -y

Now, the complete environment is ready to create a webapp.

Sri Vishnuvardhan

Written by

Sri Vishnuvardhan

Building production-grade geospatial platforms that combine GIS, remote sensing, cloud infrastructure, AI, and platform engineering to transform spatial data into scalable, real-world intelligence.

Enjoyed this article?

Subscribe to get notified when new articles on DevOps, Cloud, and platform engineering are published.

You'll receive a welcome email with a confirmation link. No spam — unsubscribe anytime.

Have a project in mind?

I work on cloud-native platforms, DevOps automation, and geospatial intelligence systems. Let's talk.

Get in touch
Creating a Webapp Environment in Docker Container by Setting up an HTTP Web server and Python… — Sri Vishnuvardhan A