Configuring HTTPD server on docker container..
In the following article we are going to configure the HTTPD server on the docker container as well as we are going to set python interpreter to run the basic python programs.
What is Docker?
In docker we have the ability to run any application over its loosely isolated environment called as container. We can also run many containers simultaneously with immense security. Docker has the ability to run several OS at a time. The time taken to install, boot and set up the OS is almost 1 second. It also needs very less RAM around 30 mbs. Docker CE is a free and open source containerization platform.
What is httpd?
The general full form of httpd is Apache Hyper Text Transfer Protocol. The httpd software belongs to the Apache community. It is basically a web server. A webserver can be defined as the OS that has the capability to run various web pages. A web server processes incoming network requests over HTTP and several other related protocols.
Lets start with the practical....
STEP 1- In the above practical there is a prerequisite. The docker needs to be installed in the Base OS.
You can install the Docker using the yum command
yum install docker
To check whether the software is installed successfully or not use the following Linux command:
docker --version
Make sure that your docker service is running or not. Sometimes the status is inactive. To check the status use 'systemctl status docker'. In case the status is inactive then start the service using the command 'systemctl enable docker'.
STEP 2- Pull docker Image (CentOS)
In order to download and install any docker image use the following command:
docker pull name_of_image:tag
To check which Docker images are running in the system use the command
docker images
Now all the task related to docker are successfully done.
Lets begin with the configuration of Webserver on the Docker container..
For launching the docker use the following Linux command:
docker run -it --name docOS01 centos:7
Within seconds the new OS will be launched..
STEP 3- Now we need to install the https software..
Simply use the following Linux command:
yum install https (in centos)
Now we need to install the net-tools software too..
In the Red hat Linux we use the command systemctl, but as we are in the CentOS, this command does not exist here. There is command called '/usr/sbin/httpd'. We can also make use of 'whatprovides' command.
Now we will make a web-page.
Use the following commands.
cd /var/www/html
vi finalproject.html
Our first task is successfully done.
Now we need to setup the python interpreter on Docker.
Firstly use the command 'yum install python3' to install the python3 interpreter on the Docker image
Successfully we have installed python3 on the httpd server on the Docker image
Congratulations Yash Labhsetwar 🎉