Configuring HTTPD Server on Docker Container and setting up Python interpreter over it

Palak Jain
3 min readMar 18, 2021

In this blog, we will configure HTTPD Webserver over Docker Container and also will set up python interpreter over it, then run python code too in it.

Here only prerequisite is docker installation in the OS.

Now moving to the implementation part:

STEP 1: Start Docker

Docker start

To start the docker, we use the command systemctl start docker. After this, we check whether it has started or not for that, we use command systemctl status docker. This command will give status, whether the docker is in running state or not.

STEP 2: Pull an Image

Pull Image

Will check images available by using command docker images, if not present then pull one by using command docker pull OS: version. After pulling image check it by the same command we used earlier to check the images.

STEP 3: Run docker

To start the docker image we use the command docker run -it — name name -p 8080:80 os:version.

STEP 4: Setting up webserver

To configure webserver first we need to install HTTPD by using command yum install httpd. We can add -y in the command for direct smooth installation.

Now go to the HTML directory by using command cd /var/www/html. After this create a HTML file that you want to be displayed on the screen.

To create a HTML file use command vi name.html.

Now to start the httpd service use command /usr/sbin/httpd.

STEP 6: Configured

Webserver has been configured, to check it use command curl http://ip/filename.

STEP 7: Installing python interpreter

To install python interpreter use command yum install python3.

Now start python3 interpreter by using command python3. Your interpreter over docker container is ready, now you can run python code over it.

Hope this blog helped you for configuring httpd webserver over docker container easily.

--

--