Configuring HTTPD Server on Docker Container

In this blog, I am going to configure the HTTPD web server on the Docker container. For this practical, I am going to use Redhat 8 Operating System and Apache HTTPD software for the webserver.

Step 1: Install Docker-CE software on Redhat 8

Now let’s list the repolist, It will show how many software have.

Step 2: Install the docker-ce software on Redhat 8

yum install docker-ce — nobest -y

Now we can check the version of the docker software.

docker — version

Step 3: Start the status of Docker

systemctl start docker

systemctl start docker

Now enable the docker service so that the docker service will be running after the system restarts. To enable the service we have to use the enable option.

systemctl enable docker

Here we can see that the docker service is enabled.

Step 4: Pull any Docker Image from the docker repository

To list the docker images available we have to use the image command.

docker images

We can see that there is no docker image available, now let’s download the centos image.

docker pull centos

Now we can check that the centos image is downloaded or not.

We can see that the centos image with the latest tag is downloaded.

Step 5: Launch the docker container with centos image

docker run -it — name webos centos

We can check the container is running or not, to check we can use docker ps command.

docker ps

By default, the centos image that we have don’t contain ifconfig command. So we can install the software which provides ifconfig command.

net-tools is the software that provides ifconfig command. So, we can install this software with yum command.

yum install net-tools -y

Now we can check the IP of the container.

Now we can check the IP of the container.

Step 6: Install apache httpd software

yum install httpd -y

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

Here i have created aditya.html file inside /var/www/html directory.

Step 8: Start the httpd service

Now we can access the web page from the browser.

We can see that we can easily access the web page which is there on the docker container.

Thank You !!

I'm passionate learner diving into the concepts of computing 💻