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:

 yum install docker-ce

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:

 docker version

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:

 docker pull image_name:version

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

 docker run -it  — name os_name image:version 
where -it means interactive terminal

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:

 systemctl start httpd

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.

# yum install net-tools

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

 yum install python3

installing python

successfully installed python in the docker container

Thank you for reading this article.




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

Recommended from Medium

The Fifth Implementation of the Community-Centric Delegation Campaign & the Second One-year Token…

How to Handle Logging in Laravel

How to Handle Logging in Laravel

Integrate Jenkins with AWS — Part IV

Pattern Matching in C# Explained In Five Minutes

What Load Testing Is In Web Development

Code by Voice Using Serenade

Google Nest

iOS — Transparent Video in SwiftUI

How To Back Up And Restore MySQL Databases

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
kore arvind

kore arvind

More from Medium

Build Golang and Kubernetes using source code and deploy Kubernetes on ppc64le by using kubeadm

Static Application Security Testing

An impenetrable DevOps cluster. Configuring and Hardening Kubernetes

把 SQLite DB 變成 App 專用資料格式