Configuring Httpd Webserver on Docker Container

shreyash kotgire
3 min readMar 14, 2021

--

In this story we will configure Apache’s httpd Webserver on Docker Container.

For downloading docker on RHEL8 first configure yum for docker and then type

yum install docker-ce —-nobest

Then pull an image of the Operating system you like by

command: docker pull <image_name:version>

Lets’ launch a container named os1 form centos image

Command: docker run -it --name os1 centos

Now lets install httpd software in the docker container.

yum install httpd

In container, systemctl related commands don’t work for this we have to manually start service.

First, write one file named index.html in /var/www/html folder

Now start service

Command: /usr/sbin/httpd

Ignore those warnings, here your service is started.

Now to enable httpd service in container we have to write this same entry into /etc/.bashrc

command: vi /root/.bashrc

Now write new entry /usr/sbin/httpd

Now the service is permanently enabled..

Now let us check output from host os means in RHEL8.

My container IP :

Now let us check result

here your webserver is active !!

Thank you for reading …!

--

--