Configure HTTPD Server and Python Interpreter on Docker Container.
Docker is a set of platform as a service (PaaS) products that use OS-level virtualization to deliver software in packages called containers. Containers are isolated from one another and bundle their own software, libraries and configuration files; they can communicate with each other through well-defined channels. All containers are run by a single operating system kernel and therefore use fewer resources than virtual machines.
Below are some of the advantages of Docker:
How to Install & Run Docker Container in your Linux Terminal?
Follow this steps to configure :
1. Go to link copy this link.
2. Go inside the directory `/etc/yum.repos.d/`
3. Create a file with the extension .repo (ex=docker.repo)
4. Inside docker.repo write the following 👇
Now install Docker using the command :-
yum install docker-ce — nobest — allowerasing
After this commands runs we will complete the installation of Docker
Now we can check the status of the docker by using command:
systemctl status docker
it is inactive(dead) to start this service we use the command:
systemctl start docker
Now download OS image using command:
docker pull os_name:os_version
To check the number of images present
docker images
Now to run the OS use command:
docker run -i -t os_name:os_version
Now check whether you are inside new OS terminal or not,read the file present in /etc/os-release
To check how many os are running use the command:
docker ps
Now let’s Configure HTTPD Server on Docker Container:
To install HTTPD on Docker Container use command
yum install httpd -y
Now start the Webserver using command systemctl start httpd
But , systemctl start httpd command does not work in docker container
To start Webserver use command /usr/sbin/httpd
- Create Web Page
To create a web page:
1. Go inside the directory /var/www/html
2. Create a HTML file
3. save the file
Now check your IP address so that we can open webpage in browser to check web server is working or not.
To check IP address use command ifconfig
But , In Docker container ifconfig command is not installed
To install ifconfig use command yum install net-tools
Now run ifconfig command and copy IP address and then open browser and paste IPaddres/HTML_file_name
Here yoou can see the web page that we have created opens that means web server is configured successfully.
Now let’s configure Python Interpreter
To install python interpreter use command
yum install python3
To run python interpreter use command python3
Now let’s run python code on the Docker Container