Setting up Python Interpreter and running Python Code on Docker Container

#Task 7.2.2

This tutorials will help to install and use Python inside a docker image

I will use centos image to install python inside that and will run a simple python program to print a string.

Pr-requisite

1. Docker Installed in the machine

STEPS

STEP 1: Pulling the image from the docker. I have already installed the docker but you can run the same command to pull image from the repos.

STEP 2: Running the image from docker

docker run -it — network host — name pythondocker centos:latest

STEP 3: Installing Python3 inside docker

dnf install python3

STEP 4: Creating a Python Program

vi python.py

and Run cat command to check the python file

cat python.py

STEP 5: Run the Python Program

python3 python.py

--

--