Configuring HTTP Server on Docker Container

Kajal Kashyap
3 min readMar 16, 2021

--

Arth Task 7.2 A

Let me first take you through some basic concepts..

🔴 What is docker ?

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.

We can launch an OS (Operating System) in just 1 second

🔴 What is container ?

A container is a standard unit of software that packages up code and all its dependencies so the application runs quickly and reliably
Containers give developers the ability to create predictable environments that are isolated from other applications

🔴 What is Apache HTTP Server ?

Although we call Apache a web server, it is not a physical server, but rather a software that runs on a server. Its job is to establish a connection between a server and the browsers of website visitors (Firefox, Google Chrome, Safari, etc.) while delivering files back and forth between them (client-server structure).

📌 Pre-requisites :

✔ Docker installed (Check this link for knowing the same)

1️⃣ Launch a container :

For this demo we will be using centOS (you can use any of your choice)

Command :- docker pull centos

Command :-
docker run -it — name <Container_Name> <Image_Name>:<Version>

Container launched

2️⃣ Install Apache HTTPD

▪ Point to be noticed- There is no need to configure yum, you can directly install the packages

Command :- yum install httpd

3️⃣ It's time to start the service:

Usually we start the service using systemctl command

But in docker we don’t have systemctl command still we can start the service by the same command which systemctl uses behind the scenes

Command:- /usr/sbin/httpd

To verify if httpd service started —
In base OS browser type <ContainerIP>:80

HTTPD service started successfully

⭕Let’s create and launch a webpage on our server

Go to /var/www/html (default location to store webpage) and create your webpage

Webpage launched

This concludes our practical of launching Apache HTTP Server on top of docker container

🤗 This blog is incomplete without Thanking my source of learning… I am greatly Thankful to Mr. Vimal Daga Sir and LinuxWorld Informatics Pvt. Ltd., under whose mentorship i am able to learn these most demanded technologies with such an ease.

🙂 Hopefully, this helped you for any doubts or suggestions, you can ping me on Linkedin I’ll be happy to help.

--

--

Kajal Kashyap
Kajal Kashyap

Written by Kajal Kashyap

When The Atmosphere Encourages Learning, Learning Is Irresistible..

No responses yet