Configuring HTTPD Server on Docker Container | Task 7.2 | ARTH
--
What is Docker??
Installation of OS is hard job & if our requirement is to install hundreds of OS then it’s impossible task of an individual. But with Containerization technology we can install OS very easily & in lesser time. Docker is a tool for containerization technology & we can install almost any type of OS using this technology within some seconds. In Docker we use another term for OS which is container.
How to Install Docker??
Redhat linux won’t have package for docker so we have to create a repo file for docker with the given base url:-
To install new version of docker we have to include “nobest” in the command:-
#yum install docker-ce --nobest
Some basic pre-requisites
So now after installing the docker we have to pull docker image from docker hub. For linux we have to pull CentOS image using command:-
#docker pull centos
We can see the docker images in the OS using command:-
#docker images
So after this pre-requisite let’s do the task
So to install OS from this docker image use command:-
#docker run -it --name <Container_Name> <Image_Name>:<Version>
After installing container we have to install “net-tools” software for “ifconfig” command.
Now to see the IP of the container we can use ifconfig command.
So for Apache webserver we to install “httpd” software.
Here you can observe a beautiful thing about docker that we don’t have to configure the yum before installing the softwares.
Now lets create a webpage inside “/var/www/html” folder.
As “systemctl” commands won’t work in docker so we have to use another command to start webservices in container.
/usr/sbin/httpd
Now we can access the webpages inside the Redhat OS using IP of Container & name of file.
So finally you can see the webpage i just start in the docker container.