Task-1 (Running ML model inside of docker container)

Mdkneema
2 min readMay 30, 2021

Task Description
- Pull the Docker container image of CentOS image from DockerHub and create a new container
- Install the Python software on the top of docker container
- In Container you need to copy/create machine learning model.

After installing docker in the system,

Pull the docker image that would be used to run the ml model-

The image that will be used will be centos-

cmd — docker pull centos:latest

docker images | grep centos # to see the downloaded image

Launch The container into the rhel8 system using the command —

docker run -it — name os_for_ml centos:latest

Installing the python3 for python environment by the command-

yum install python3

Installing libraries for python program that will run ML code-

pip3 install scikit-learn # will install pandas, numpy also.

Copying the ML code inside the VM and then in Container by command-

Using winscp, transfer the weight file into the VM

Now, copying the file in container-

docker cp /root/marks.pk1 os_for_ml:/root/marks.pk1

Now, run the python program, import the joblib library, load the model into the variable ‘model’ and then predict the output.

--

--