Configuring HTTPD Server on Docker Container and Setting up Python Interpreter Docker Container
Firstly we have to start with installing the docker on the OS we can do it by the following command-
$ yum install docker-ce --nobest -y
Then we have to download the images ,images means image of the OS like ubuntu , centos etc. by using the command-
docker pull _IMAGE NAME_
example- $ docker pull centos:7
we can check the all images using the command-
$ docker images
we can also check information of docker installation as-
$ docker info
For checking information of all images , use the command-
$ docker ps -a
Now we have to launch the OS using the command-
$ docker run -it --name task7 centos:latest
Now we have to configure the httpd server inside docker as follows-
$ yum install httpd
Now go to the directory of html as follows-
$ cd /var/www/html
And also make the file in that named as task.html-
Now start the httpd server inside docker as follows-
$ /usr/sbin/httpd
we cannot use systemctl start httpd as docker doesnot understood this command.
Now we can check this in the web browser(our html file). Firstlt install ifconfig as-
$ yum install net-tools
Now use $ ifconfig command to check IP address and then run in web browser-
Now install python interpreter as follows in docker-
$ yum install python3
Now make the file as task.py
Now run this using- python3 task.py
Thank you.
Great Saket Sharma