Machine Learning Model inside Docker Container
In this article we’ll launch an machine learning model inside a docker container :
In order to that we’ll use use RedHat Linux either use the aws web ui method or the BareMetal method ,
let’s begin :
firstly we’ll launch RedHat Linux and switch to the root account using the command :
sudo su - root
then , well install docker using the command :
yum install docker -y
then we’ll start the docker using the following command :
systemctl start docker && systemctl enable docker
after that we’ll launch an docker image using the following command:
docker pull centos:latest
docker images //to chech for images
now we’ll create a container using centos images with the name ml-model ,with help of following command :
docker run -it --name ML-model centos:latest
now moving further we’ll install python and some libraries using following command :
yum install python -y
yum install nc -yyum install net-tools -y
and then for python libraries :
pip3 install numpy
pip3 install sklearn
pip3 install pandas
now moving further , we’ll copy the data file to the container using following command ,
docker cp <src> <container_name>:<dest>
docker cp Salaray.csv ML-model:/task1/
now creating the file for the training model and to save the model ;
vim model.pypypy
now run the following command :
now close that using “ esc :wq “
after that run the following command:
python3 model.py
well this is how we can run machine learning model inside the docker container .
hope you all liked this and find it useful :)