Task Description 📄
📌 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.
Before jump into the tutorial, make sure you have the set-up the VM as follows
First, stop the SELinux security
To check use the command: #getenforce
Note: if it is permissive you are good to go
Then, disable the firewall by using the command as follows
#systemctl disable firewalld
Check the status as follows: #systemctl status firewalld
Install the webserver to allow others to connect with you remotely. For which run the following command
Here, we using the apache webserver
#yum install httpd
and then start the apache server, using the command as follows:
#systemctl start httpd
Setting up the CGI-Python program
Go to the directory cgi-bin and create a python file and make it asexecutable
Note: Here, we named docker as the name of the python file
Open the file using vim editor or gedit
To make this file execute run the follwing command
#chmod +x docker.py
Note: Giving this file both read and write access
Let start discussing how we going to implement this.
First, we need to create a basic HTML file containing an input tag and button. It is your choice to style the HTML layout using CSS
In the third step, we need to the CGI program using python. As it allows to run os or the Linux commands remotely using a webpage.
Sample code of the CGI Program
import timeprint("content-type: text/html")
cmd = f.getvalue("x")
o = subprocess.getoutput("sudo " + cmd)
Code is explained below:
- Imported the libraries
- Defining the context type which we will be receiving from the client
- Retrieving the value from the webpage so we can run that command in the servers where we have Docker available
Now, All you need to do is open the HTML page on any browser.
This app will help the user to run all the docker commands like:
👉docker rm -f
For more details visit this GitHub link: https://github.com/ajmalmohammedn/summer_program_2021/tree/main/task%207
Thank you for reading.