Configuring HTTPD and Python on Docker.
Configuring web server in docker
A container is a standard unit of software that packages up code and all its dependencies so the application runs quickly and reliably from one computing environment to another. 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. Container images become containers at runtime and in the case of Docker containers — images become containers when they run on Docker Engine. Available for both Linux and Windows-based applications, containerized software will always run the same, regardless of the infrastructure. Containers isolate software from its environment and ensure that it works uniformly despite differences for instance between development and staging.
To configure web server you need to have docker install in your Linux
In Redhat you have to make a repo for docker using following command in repos directory.
[docker]
baseurl=https://download.docker.com/linux/centos/7/x86_64/stable
gpgcheck=0
And the use the command
yum install docker-ce — nobest
ce stands for community edition
You can check docker by using
rpm -q docker command
After starting the docker services by entering
systemctl start docker
Now pull the image in docker using following command
docker pull <image_name>:<version>
and then
docker run -i -t <image_name>
Now download httpd in it using command
yum install httpd
Then second, we will put some html code in /var/www/html folder.
start HTTPD by using command
/usr/sbin/httpd
Now check your docker ip and test it in your web browser
Hence task is successful!
Installing Python
As docker is already installed start your docker services and then
docker run -i -t centos
yum install python3
Then write some code and then run it
Here you can see python code is working in the Docker Container.
Hence task running successfully!