Python Interpreter On Docker Container

launching an Apache webserver and running Python interpreter on a docker container

Monil Goyal
3 min readMar 8, 2021

In this article, we will launch a docker container on RedHat VM and run a python interpreter on it.

So we are going to follow the following steps:

  1. Installing and Setting up Docker
  2. Running a Docker Container and Exposed is with 8080 port
  3. Setting up httpd server on Docker container
  4. Setting up Python Interpreter on Docker container

Step 1: Installing and Setting up Docker

Configuring yum

Run the following command to configure yum.

echo "
[docker]
baseurl=https://download.docker.com/linux/centos/7/x86_64/stable/
gpgcheck=0
" > /etc/yum.repos.d/docker.repo

Install Docker

yum install docker-ce --nobest --skip-broken -y

you can check whether Docker is installed or not as shown.

start docker service

systemctl start docker 

Check the status of docker

systemctl status docker

Install Centos Image version 7

Step 2: Running a Docker Container and Exposed is with 8080 port

docker run -dit --name OS_NAME -p 8080:80 Image:version

To login to docker container name use this command

docker exec -it OS_NAME bash

Step 3: Setting up httpd server on Docker container

yum install httpd -y

Creating HTML page in /var/www/html folder

echo live > /var/www/html/index.html

Starting Httpd service

/usr/sbin/httpd

Now, you can see the result with IP of local VM with port 8080.

Step 4: Setting up Python Interpreter on Docker container

Installing python package

yum install python3 -y

Run python interpreter

python3

Thanks, Everyone for reading…

Keep Learning Keep Sharing !!!

--

--