Setting up Python Interpreter and running Python Code on Docker Container

Deepanshu Yadav
2 min readMar 13, 2021

So, we must have docker installed on our system for this. If you don’t know then read the below story in which i showed how to configure docker on redhat 8.👇

https://deepanshuyadavv11.medium.com/install-docker-on-redhat-and-configure-apache-httpd-web-server-on-it-d5bb032594b8

Below is my redhat 8 system with docker in it. I have some images in it also of centos and httpd. let’s install the python interpreter in using centos image.

NOTE- if you don’t have the image then you can install using the command docker pull centos as shown below👇

🔰Now lets launch a container using this image. command is shown in the below image.🔰

docker ps -a is a command to check the already present containers and docker run -it — name anyname imagename is command to launch a container.

Now you are inside your docker container and you can run most of the commands inside this os that a normal redhat or centos. Now lets install the python interpreter.

🎇To install python in centos, we can use a command yum install python3. see below🎇

✨✨That’s all. we are done. Now we can run any python code.✨✨

Thanks for giving your time👲😊.

--

--