How to Set up Python Interpreter and running Python Code on Docker Container

Let’ see how can we set up Python Interpreter and running Python Code on Docker Container.

The Image I found is centos: 8, it supports python interpreter.

Command used to download the image: docker pull centos:8

Command used: docker run -it — name myos2 centos:8

Run the container using the centos image
Run the container using the centos image
Run the container using the centos image

Command used: dnf install python3 -y

Command used: python3 -V

python has installed
python has installed
python has installed

5. Create a python File and run it

Command used: mkdir pythoncode

cd pythoncode

vi hello.py

hello.py file
hello.py file
hello.py file
File Successfully Run
File Successfully Run
File Successfully Run

The file has successfully run. Hello printed.