Configuring HTTPD Server on Docker Container

Configuring HTTPD Server on Docker Container

In the following article we are going to configure the HTTPD server on the Docker container. In this practical we're using RHEL8 as Base operating system and Apache HTTPD as webserver.

What is Docker ?

Docker is an open source containerization platform used to configure the environments on the top of base OS. It is an application build & deployment tool. The time taken to install, boot and set up the OS from Docker is almost 1 second. It also needs very less RAM around 30Mbs.

What is Web-Server ?

Web-Server is a computer that runs a websites. It’s main objective is to provide web services to its clients. A web server processes incoming network requests over HTTP and several other related protocols.

Web-Server on the Top of Docker

Let's start with the practical..

Step 1 : Install Docker software on Base OS (RHEL8)

To install the Docker software on RHEL8 first we have to create the repo for the software.

cd  /etc/yum.repos.d/
gedit docker.repo
No alt text provided for this image
yum repolist
No alt text provided for this image

Step 2 : Install the Docker software

yum install docker-ce --nobest -y

To check if it's installed, we check version of Docker

No alt text provided for this image

Step 3 : Start the Docker

systemctl start docker
systemctl status docker
No alt text provided for this image

Step 4 : Pull any Docker Image 

Initially there will be no docker image available so we pull the image from Docker repository.

docker images
No alt text provided for this image
docker pull centos:latest
No alt text provided for this image

Step 5 : Launch the Docker container with this image

docker run -it --name mywebos centos
No alt text provided for this image

To check all running containers

No alt text provided for this image

This centos image that we have pulled don’t contain ifconfig command. So we can install a software which provides ifconfig command, i.e., net-tools.

No alt text provided for this image
yum install net-tools -y
No alt text provided for this image

Now ifconfig command will work.

No alt text provided for this image

Step 6 : Install apache HTTPD software

yum install httpd -y
No alt text provided for this image

Step 7 : Put the web page inside " /var/www/html " directory

HTTPD software by default reads the file from " /var/www/html " directory. So we have to put all the HTML files here.

No alt text provided for this image

Step 8 : Start the HTTP service

At last, we have to start the HTTPD service. 'Systemctl' command is not present in docker containers by default. So since systemctl internally loads " /usr/sbin/httpd/ " file to start the service, we can use this file.

No alt text provided for this image

Now we can access the web page from the browser.

URL - http://172.17.0.2/mywebpage.html

No alt text provided for this image

We have successfully launched the Webpage on Docker container.


***** THANK YOU FOR READING!! *****

To view or add a comment, sign in

More articles by Khushi Garg

  • Industrial Use-cases of Ansible

    What is Ansible? Ansible is an automation software tool that provides simple but powerful Automation for cross-platform…

  • Benefits that MNC’s are getting from AI/ML

    What is Artificial Intelligence? Artificial Intelligence is the simulation of human intelligence to the machine that is…

    2 Comments
  • Building Basic AWS Cloud Infrastructure using AWS CLI

    TASK DESCRIPTION : Create the following using AWS CLI: Create a key pair Create a security group Launch an instance…

  • Setting up Python on Docker Container

    In the following article we're going to set up Python Interpreter and run python code on a Docker container. For this…

    2 Comments
  • KUBERNETES - A Container Management tool

    What is Kubernetes ? Kubernetes is an open-source Container-Orchestration system software for automating Deployment…

    2 Comments
  • DOCKER AUTOMATED USING ANSIBLE

    To configure and start Docker services and configure Apache Webserver on it using Ansible playbook. TASK DESCRIPTION :…

    4 Comments
  • UNILEVER Case Study - AWS

    This Article shows the case study of Global Cloud Leader that is Amazon Web Services ( AWS ) Cloud . In this we'll see…

    2 Comments
  • "BIG DATA": Problems, solutions and its management!

    "Over 2.5 quintillion bytes of data is created every single day, and it’s only going to grow from there.

    5 Comments
  • Deploying WordPress on Google Cloud Platform by integrating various GCP services..

    Hello Readers! This is my Google Cloud Platform task by integrating all those things which I've learnt in my two days…

    5 Comments
  • Google Cloud Platform (GCP)

    This article talks about all the services in Google Cloud Platform which I learnt from 2 days of workshop organised by…

Insights from the community

Others also viewed

Explore topics