Setting up Python Interpreter and running Python Code on Docker Container

Aditya Raj
Nov 13, 2020


In this blog, I am going to set up Python Interpreter on a docker container and run python code on a Docker container. The prerequisite for this practical is that the docker engineer should be running.

Step 1: Launch the docker container with centos image

In this step, we will launch the container with a centos image.

docker run -it — name pythonos centos

Now we can check the container is running or not with docker ps command.

docker ps

We can see that one container from the centos image is running.

Step 2: Install python3 software in the container.

In this step, we will install the python3 software inside the container. To install we can use the yum command because we are using centos image.

yum install python3

We can check the version of python 3 software.

Step 3: Write Python code in the container.

In this step, we will write the python code and we will run the code.

Now run the python code.

We can see that we can easily run the python code inside the docker container.

Thank You !!



Aditya Raj

I'm passionate learner diving into the concepts of computing 💻