Web-server and python interpreter in Docker Container
Docker is a set of platform as a service 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.
Docker Image :
A Docker image is an immutable (unchangeable) file that contains the source code, libraries, dependencies, tools, and other files needed for an application to run.
Apache httpd :
The Apache HTTP Server, colloquially called Apache, is a free and open-source cross-platform web server software, released under the terms of Apache License 2.0. Apache is developed and maintained by an open community of developers under the auspices of the Apache Software Foundation.
Python is an interpreted, high-level and general-purpose programming language. Python’s design philosophy emphasizes code readability with its notable use of significant indentation.
In this blog, we will see how , a Docker container is launched in RHEL8 ,then setting up Apache Web-server and Python interpreter
- RHEL8 booted VM / Bare-metal
- Internet connection of Device
- Your patience….
Lets see how we can do above task:
🟥Installing Docker in RHEL8 :
We are using VM booted with RHEL8 in Virtual Box…..
🔐To download docker we have to first of all setup the docker repo :
Checking repolist :
Heading to conf file of yum :
baseurl = https://download.docker.com/linux/centos/
gpgcheck = 0
Installing docker-ce :
#yum install docker-ce --nobest
Installation done !!!!
Bravo ! you have completed first step…
Checking docker install or not :
Starting docker service :
#systemctl start docker
#systemctl enable docker
#systemctl status docker
Pulling centos latest image from dockerhub:
#docker pull centos:latest
Checking any container launched yet or not !
Launching container with CentOS image network same as host :
#docker run -it --name mywebospy --network host centos:latest
Installing net-tools as we are interested in knowing IP of conatiner:
#yum install net-tools
Knowing IP of container:
Now its turn to install APACHE HTTPD SERVER:
#yum install httpd -y
We dont have systemctl command in conatiner , so to start service we need to use :
Putting up webpage in document root of Apache server:
#cat > /var/www/html/index.html
IP of container is :
We don’t have GUI available right now, that is we need to check if the webserver is properly configured or not …
But we have curl command in RHEL8 which works as CLI browser…
Yipee! we have successfully setup Web-server in container
Installing python3 in conatiner:
#yum install python3
We are ready to write python scripts now….