Configuring HTTPD and Python on Docker.

Configuring web server in docker

A container is a standard unit of software that packages up code and all its dependencies so the application runs quickly and reliably from one computing environment to another. A Docker container image is a lightweight, standalone, executable package of software that includes everything needed to run an application: code, runtime, system tools, system libraries and settings. Container images become containers at runtime and in the case of Docker containers — images become containers when they run on Docker Engine. Available for both Linux and Windows-based applications, containerized software will always run the same, regardless of the infrastructure. Containers isolate software from its environment and ensure that it works uniformly despite differences for instance between development and staging.

To configure web server you need to have docker install in your Linux

In Redhat you have to make a repo for docker using following command in repos directory.


And the use the command

yum install docker-ce — nobest

ce stands for community edition

You can check docker by using

rpm -q docker command

After starting the docker services by entering

systemctl start docker

Now pull the image in docker using following command

docker pull <image_name>:<version>

and then

docker run -i -t <image_name>

Now download httpd in it using command

yum install httpd

Then second, we will put some html code in /var/www/html folder.

start HTTPD by using command


Now check your docker ip and test it in your web browser

Hence task is successful!

Installing Python

As docker is already installed start your docker services and then

docker run -i -t centos

yum install python3

Then write some code and then run it

Here you can see python code is working in the Docker Container.

Hence task running successfully!



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