Setting up Python Interpreter and running Python Code on Docker Container

Ritesh Singh
Dec 6, 2020

Prerequisite πŸ”₯

  • Docker installed.

Step-1)Create one Dockerfile

  • Install python and some basic tools.
FROM centos
RUN dnf install python36 -y
RUN dnf install net-tools vim which -y
  • Build Dockerfile
docker build -t IMAGE_NAME .

Step-2)Run above the docker container.

docker run -it --name NAME_OF_CONTAINER IMAGE_NAME

Output

  • Running the python code.
Python Code
python3 FILENAME.py

--

--