JavaScript Integration with Docker using Python CGI


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 <>

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




Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium


Numba — 5-minute guide

Inter-Process Communication Affects Application Response Time

Conquer Customer Support

Building wealth — Some life lessons

Personal Knowledge Graphs

Kotlin on Android — The Better Programming Language

What makes Amazon Kinesis Data Streams useful for streaming ?

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Anjali Singh

Anjali Singh

More from Medium

Docker: Images & Containers

Using Celery with Flask for asynchronous tasks

Asyncio — A guide to asynchronous behavior in Python

How to reverse parametrize in PyTest fixtures

Indirect parametrize