📌 In this task, you have to create a Web Application for Docker (one of the great Containerization Tool which provides the user Platform as a Service (PaaS)) by showing your own creativity and UI/UX designing skills to make the web portal user friendly.
📌 This app will help the user to run all the docker commands like:
👉docker rm -f
👉 add more if you want. (Optional)
👉 Make a blog/article/video explaining this task step by step.
⚙️ Task 7.2 -
To start this task we have to first start our VM and OS(RHEL8) and install ‘httpd’ service in our OS.
‘httpd’ is the Apache HyperText Transfer Protocol (HTTP) server program. It is designed to be run as a standalone daemon process. When used like this it will create a pool of child processes or threads to handle requests.
yum install httpd
Then we have to disable our firewall and start the httpd service.
systemctl disable firewalld
systemctl start httpd
Now we have to go in the directory “/var/www/html” and create a file using ‘gedit’ command.
This file contains all the front-end of our website and should also include the script to connect our server to OS.
The script part given below is from the code that I have shared in my GitHub repository below.
var xhr=new XMLHttpRequest();
Now change the directory to “var/www/cgi-bin” and make a Python file using ‘gedit’ command with “.py” extension to write our backend code.
This file contains the backend code(in Python).
import timeprint("content-type: text/html")
print()print("Hello from backend")
o=subprocess.getoutput("sudo "+ cmd)
After this so that any non-root user can access from my server, I made changes as follows so that using the “sudo” command the non-root user can access the docker services.
In the terminal, we have to go to file-path ‘/etc/group’.
Now we have to make the following change to allow our non-root users to access docker.
Now we have to again change the directory from terminal to “/etc/sudoers” and make the following changes over there.
We have to give access to our python file to be executable from the guest user. So for this, we have to give access to it by going into the directory where it was stored and then using the command given below.
chmod +x <file_name>.py
Now we are all set and can use our application in Windows web browser (Chrome or Edge) with the help of URL.