JavaScript Integration with Docker using Python CGI
Hello,
In this article, I have explained integration of JavaScript with Docker so that users can execute docker commands easily without much pre requisite knowledge.
We have to first install httpd service in our operating system.
httpd is the Apache HyperText Transfer Protocol (HTTP) server program designed to be run as a standalone daemon process.
yum install httpd
Then we have to disable our firewall and start the httpd service.
systemctl disable firewalld
setenforce 0
systemctl enable httpd.service
systemctl start httpd
Now we go in the directory “/var/www/html” and create a html file that contains frontend of the website and the script to connect server to our OS.
cd /var/www/html
gedit <file_name>.html
Now change the directory to “var/www/cgi-bin” and make a Python with .py extension taht contains the backend code.
cd /var/www/cgi-bin
gedit <file_name.py>
We have to make our python file executable for the guest user.
chmod +x <file_name>.py
In order to provide access to non-root user from my server, I made changes so that using the sudo command docker services can be accessed.
vim /etc/group
Now again change the directory from to “/etc/sudoers” and make the following changes.
vim /etc/sudoers
Now we can access our website in web browser by entering the URL in the following format.
http://<IP Address of server>/<file_Name>.html