Installation of Python3 on the top of docker container and running the python code inside a container

Sarthak Agarwal
2 min readMar 14, 2021

Firstly we launch a docker container CentOS inside our base Operating system and then we run the terminal by using the command πŸ‘‰

#docker run -itβ€Š--name <name you want> centOS:latest

After logging on to the terminal of CentOS we do the yum configuration part to install the httpd software inside it.

For installing the python3 software we use the command πŸ‘‰

#yum install python3

After the download is completed we write our python code to run it on the terminal.

To open terminal we use the command πŸ‘‰

# vi <filename.py>

.py extension is used as it is a python code
And to close the terminal we hit ESC key and then typeΒ :wq to save and exit from the vi editor.

As we can see now the python code is executed successfully.

Hope you guys may like the approach of executing the python code inside the docker container.

Thank You 😊

--

--

Sarthak Agarwal

Cloud & DevOps Enthusiast β˜…ARTH Learner β˜… AWS β˜… GCP β˜… Jenkins β˜… K8S β˜… Ansible β˜… MLOps β˜… Terraform β˜… Networking β˜… Python