Open In App

Docker – Setup in RHEL8 for Python

Developing an application or software requires starting several microservices in one machine. So if you are 10 of those services then you require 10 VMs on that machine. 

How Docker solves the above problem?

With help of docker, you can run multiple microservices in the same VM by running multiple docker containers for each microservices. Containers are like lightweight VMs. Docker is designed to make things easier and efficient by creating, deploying, and running an application inside the containers. You don’t have to pre-allocate any RAM in containers.



As we run our machine learning models in jupyter notebook so to Integrate Machine Learning with DevOps, we can also run our model inside the container. To run your machine learning models and other python projects inside the docker container, here are the few steps that you need to follow to set up the complete environment.



Step 1:Install Docker

 cd /etc/yum.repos.d/   

Here cd is used to change the directory and “/etc/yum.repos.d “ is a path and name of the directory.

vim docker.repo   

Here vim is an editor command.

[docker]
baseurl = https://download.docker.com/linux/centos/7/x86_64/stable/
gpgcheck = 0
name = Docker repo

yum repolist     

yum install docker-ce --nobest -y  

systemctl start docker 

systemctl status docker 
systemctl restart docker    

Step 2: Launch Container.

docker pull centos:latest  
docker run -it centos:latest  

Step 3: Install Python & Libraries inside Container. 

yum install python3

pip3 install numpy

At this point, your python setup is ready to work with any python project inside the docker container on RHEL8.

Article Tags :