Configuring HTTPD Server on Docker Container!!
Why you should use Docker and containers?
Docker containers provide a way to get a grip on software. You can use Docker to wrap up an application in such a way that its deployment and runtime issues — how to expose it on a network, how to manage its use of storage and memory and I/O, how to control access permissions — are handled outside of the application itself, and in a way that is consistent across all “containerized” apps. You can run your Docker container on any OS-compatible host (Linux or Windows) that has the Docker runtime installed. A book published in 1981, called Nailing Jelly to a Tree, describes software as “nebulous and difficult to get a firm grip on.” That was true in 1981, and it is no less true nearly four decades since.
Apache HTTPD Server:-
The Apache HTTP Server is a robust, commercial-grade open source Web server developed by the Apache Software Foundation (http://www.apache.org). Red Hat Linux 8.0 includes the Apache HTTP Server version 2.0 as well as a number of server modules designed to enhance its functionality.
The default configuration file installed with the Apache HTTP Server works without alteration for most situations. This chapter, however, outlines how to customize the Apache HTTP Server configuration file (/etc/httpd/conf/httpd.conf) for situations where the default configuration does not suit your needs.
💠 TASK DESCRIPTION:-
⚡Configuring HTTPD Server on
⚡ Setting up Python Interpreter and running Python Code on Docker
Let’s GO ON Practical:-
To configure HTTPD Server on Docker use following Steps:-
1:- Run docker ps command which will give info about all the container running but here in this case no container is running and after that we used the command docker pull centos:7 which is the docker image of centos 7. This will pull the image.
2:- Now we will run docker run -it — name myos1 centos:7 to run the container.
cmd is:- docker run -it — name myos1 centos:7
3:- To configure the httpd command using yum install httpd.
4:- And after this ,we installed net-tools -y which gives the ifconfig comand.
5:- After this we checked the IP of the container using ifconfig command.
6:- Since to configure httpd we have to use systemctl start httpd but that doesn’t work so we used /usr/sbin/httpd to start httpd.
7:- After that we created Task7.html file inside /var/www/html/ and got the the Output.
➡
Setting up Python Interpreter and running Python Code on Docker Container:-
8:- Now in the same container which is launched we will run a Python Program But for that we will first install python3 by using command yum install python3.
Now, we will change and run this command “docker run -it — name myos3 centos:7 “ to run the container.
9:-Now check python3 is installed or not. For this Check the version of python .
10:- After installing we created a python file using vi command.
command is :- vi task 7.2.py
In this python file we write the code.