Setting up Python Interpreter and running Python Code on Docker Container

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.

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.

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.

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



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

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