Configure Apache Webserver on Docker Container

This article discussed the elasticity task. This task consists of three parts as mention as follow:

🌀 Task 7.2 in the Docker Container

🔰 7.2-A Configuring HTTPD Server on Docker Container.

🔰7. 2-B Setting up Python Interpreter and running Python Code on Docker Container

So in this article discussed how to configure apache webserver on the docker container for this :

🔰 7.2-A Configuring HTTPD Server on Docker Container:

first we need to install docker in your system.

for installing docker in your system use this command:

if using this command docker doesn’t install then you need to configure yum repolist and create docker. repo and write these lines:

docker. repo file

and configure this repo:

configure yum repository

After installation check, docker installs or not using this command:

Now start docker service and check the status using commands:

Docker Activated and is enabled.

Now docker is successfully installed and active. In the docker container installed image for performing the task so pull the image in the Docker container using below command:

To run a new docker container using centos image with lastest version below the command:

Image installed in the docker container

so to configure a web server in any system performs three steps:

Installing the webserver software.

writing a webpage code or HTML code in /var/www/html folder.

run the services and check server run or not using URL type in the browser.

To install software here I am using apache webserver:

# yum install httpd

Install httpd(Apache) server

Installed the httpd.

Successfully installed httpd

write a code in the index.html file and save this file in html folder.

html code we have written in index.html.

now start the httpd services in the container in the below command:

running this command will cause an error.

we got the Error.

Instead, we can write below the command for start httpd service:

To see the code on the website need the IP address of the docker container. but in the container image, we need to install ifconfig for checking the IP address.

package installed.

ifconfig will w give the output

using this IP we can see the output in the web browser.

we got the output of the webpage.

🔰7. 2-B Setting up Python Interpreter and running Python Code on Docker Container.

To use python in the docker containers first we need to install python3

installing python

successfully installed python in the docker container

Thank you for reading this article.



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