Launching Webserver and Python Interpreter On Docker Container

Image for post
Image for post

Docker is an open-source containerization software that creates isolated environments to run an application. 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.

Installation :

To install docker on RHEL 8 you can follow this pdf

Task :

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

Configuring Httpd Server :

We need to Configure the HTTPD Server inside Docker Container . I have used CentOS Image as base image to launch docker Container .

  • To download the Docker Image used as base image for the Container docker has Command as :
  • To launch any Docker Container docker has following command (This command will download the image automatically) :
  • Launch the docker container using base CentOS Image by Running the Command as:

The above command includes the flags as :

  • -i flag launch the container in interactive mode
  • -t flag gives a terminal as container boots up.
  • -p option maps the host’s 80 port with 9091 port of Docker Container .

2) As we are inside the container we have to Install HTTPD Package for Configuring Webserver .

  • Finally the Webserver is successfully configured inside docker container. To test the Webserver write a simple html code inside /var/www/html
  • To access the Apache Webserver content inside Docker Container we have to use <public_ip of host>:9091/home.html

Installing Python3 Inside Docker Container

  • Cheking python3 is correctly installed
  • To exit container type exit

Written by

I’m an undergraduate student at IIIT Ranchi, pursuing my B-Tech in Electronics and Communication Engineering.

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