Configuring HTTPD Server and running Python code on Docker Container…
What is Docker?
A Docker container image is a lightweight, standalone, executable package of software that includes everything needed to run an application: code, runtime, system tools, system libraries and settings, that makes it efficient in terms of space as well as time!
PART 1: Configuring HTTPD server on Docker Container…
How to install Docker on Linux OS (RHEL 8)?
→First go inside the yum repo directory using the cmd,
→Then create a filename called docker.repo and write the following lines,
→ Then run the yum repolist command to check that your docker repo is successfully created and configured.
yum install docker-ce --nobest -y
The best possible version (by using — nobest) of docker has been successfully installed!!! We can run docker --version cmd in order to confirm the successful installation.
Start the Docker Service in your base OS
systemctl start docker
Check the status (active/inactive) by using
systemctl status docker
Launching Docker OS
In order to use Docker OS, we need to pull a Docker image,
docker pull centos
docker run -it — name webserver centos:latest
Now we are inside our Docker OS (Centos)!
Configuring Apache server on top of Container
yum install httpd
Go inside /var/www/html using cd cmd, and create a file and put some content..
→ Now we need to start httpd service and for that we need to use the following command since systemctl start httpd doesn’t work in container OS
Service has been successfully started!!
Configuring httpd on docker is Successfull!!!
PART 2: Setting up python interpreter and running a python code!
yum install pyhton3
Python Successfully installed!!!
You can either run the Python interpretor by using python3 cmd or create a small .py file run python3 filename.py.. In either way your python code is successfully running on your docker container!!!
We’ve successfully installed docker, configured HTTPD service on top of docker and finally set up the python interpreter and got the output by running a simple python code!!!!