RUNNING PYTHON ON DOCKER

Rishabh Jain
3 min readApr 1, 2021

Namaste! amazing people here comes a new blog on launching the Python Interpreter on the top of the Docker container. Its a new and amazing setup in which first of all the whole Operating system will be launched with in the Base OS in just a second. The Docker is so fast and powerful technique in terms of the Virtualization which is again a superb and beautiful technology in today’s world.

So, let us start to build the setup. But first of all Let me introduce some terminologies so one can be familiar with the setup going to be constructed down.

DOCKER

Docker is an open platform for developing, shipping, and running applications. Docker enables you to separate your applications from your infrastructure so you can deliver software quickly. With Docker, you can manage your infrastructure in the same ways you manage your applications. By taking advantage of Docker’s methodologies for shipping, testing, and deploying code quickly, you can significantly reduce the delay between writing code and running it in production.

CONTAINER

A container is a standard unit of software that packages up code and all its dependencies so the application runs quickly and reliably from one computing environment to another. Available for both Linux and Windows-based applications, containerized software will always run the same, regardless of the infrastructure.

So, lets move for creating the setup.

Pre Requisites For The Setup.

  1. RHEL 8
  2. Docker Installed

So, First of all start the Docker service in the OS as shown below.

Now check whether docker service is started or not by the command shown below.

Now we need to launch the docker container on the top of Base OS by the command as shown below.

We are now entered in a container launched with an image of CENTOS operating system.

After this we need to install the python3 package in the container by the command shown below.

Once python3 package is installed one can check it by just writing python3 in the terminal and python Interpreter will be opened as shown below.

Once this is done every library of python can be imported and can be used. For testing we will be using the OS module as shown below.

The Python Interpreter is now setup and successfully running on the top of the docker.

HOPE YOU LEARNED AND LIKED CREATING THE SETUP. THANKS!!

--

--

Rishabh Jain

I am a tech enthusiast, researcher and an integration seeker. I love to explore and learn about the right technology and right concepts from its foundation.