Python with Docker🐋

What is Python? Why Python?

💁🏻‍♀️Python is a popular programming language. It was created by Guido van Rossum, and released in 1991. Its latest version is Python 3.7
It is used for :
📌Web development (server-side)
📌Software development
📌Mathematics
📌System scripting.
📌Python works on different platforms (Windows, Mac, Linux, Raspberry Pi, etc).
📌Python has a syntax that allows developers to write programs with fewer lines than some other programming languages.
📌Python runs on an interpreter system, meaning that code can be executed as soon as it is written. This means that prototyping can be very quick.
📌Python can be treated in a procedural way, an object-oriented way, or a functional way.

Task Description📃

Setting up Python Interpreter and running python code on docker container

Let’s move towards the practical part

Firstly before running docker services I will disable firewall security of base o.s using #systemctl stop firewalld & change mode of SELINUX. Here #setenforce 0 is a command which changes SELINUX from targeted to Permissive Mode. In this mode, we can perform all actions without any security issues.

Security disabled

Now we will check our docker images

Myths & Reality

Here I have a centos image that I had already installed a few hours ago, now a Myth🌀 comes in a scenario that the storage provided by docker containers is ephemeral in nature. It means docker provides us temporary storage & after each exit from o.s, we lose our data.

But here the Reality💯 is quite fishy😳actually we all think we lost our data but behind the scene, it is still there how can we check it ?? we can use #docker ps -a herein above image we can see my all last exited o.s, nowhere I got my previously used container unique id & name.

So by using #docker start os-id here I started my previous o.s simultaneously I also went inside o.s using #docker attach os-id.

Hence, we can say docker provides permanent storage of all our files, data, etc. Until we manually terminate it.

Now it’s time to set up a python interpreter so we need to install it by using the command #yum install python3

Python on top of docker successfully installed.

Let’s now run the python interpreter

Here #python3 is the command which helps the user to enter into a python interpreter.

Now we will make a python file using #vi gc.py

Python Code

Then to run this code we will use #python3 filename.py

Code Successfully Running

Finally, our Task_7.2_B i.e Setting up Python Interpreter and running python code on docker container is accomplished.

Thank you for reading my article🤗

Keep Learning🤩Keep Sharing🤝🏻

Good Day!

--

--

--

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Zen and the Art of the Unity Editor Layout

Singleton pattern in python libraries

What’s the Code in Code for Asheville?

CS373 Fall 2021: Week 6

An introduction to Wobbly: an app for 21st century workers’ power.

Hire Laravel Developers For Top Notch Web Development Services.

Hacking GitHub to build your own wiki

Analyzing the Code of ROOT, Scientific Data Analysis Framework

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Gulsha Chawla

Gulsha Chawla

More from Medium

Variables in Python

AutoDataDictionary: Python Package

Let’s try Tarot through Python

Convert XML to CSV Using Python