Task 1: Loading Machine Learning model on Docker container

Aditya Jain
3 min readMay 29, 2021

--

This loads up your machine learning model on the Docker Container,hope you will enjoy itπŸ“„

πŸ‘‰ 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 which you have created in jupyter notebook

Step 01:Check wheather docker is running or not:

Step 02 : Pull the Centos Image from Docker hub.

β€œ docker pull centos:latest β€œ

Step 03 : Create a Container with the help of Centos image.

β€œ docker run -i -t β€” name=container_name centos:latest β€œ

Step 04 : Check Container Start or not. if doesn’t start please re check your command or use others command.

Step 05 : We want to Download Python Software inside Container. Use the command

β€œ yum install python3 β€œ

Step 06 : Install all the libraries in your RHEL8. For Machine Learning model depend.

β€œ pip3 install numpy β€œ

β€œ pip3 install pandas β€œ

β€œ pip3 install scikit-learn β€œ

Step 07 : Install Vim by using the following command if not installed before:

β€œ yum install vim -yβ€œ

Step 08: Copy Your model Inside Container. and it’s copied or not. If You have an error of your file or folder is not show there then with the help of winSCP software you can copy your file or folder and paste it to your Linux. and then check with the help of <ls> command or you can mail yourself the file of dataset if it is a small dataset only.

β€œ docker cp Model_file_name Container name:/model_file_name β€œ

You need to run this command in our base/host system in my case it is Redhat Linux

Step 09 : Create a Model file in Docker with the following code:

Step 10: Run the Model.

β€” β€” β€” β€” β€” β€” β€” β€” β€” β€” β€” β€” β€” β€” β€” β€” β€” β€” β€” β€” β€” β€” β€” β€” β€” β€” β€” β€” β€” β€” β€” β€” β€” β€” β€” β€” β€” β€” β€” β€” β€” β€” β€” β€” β€” β€” β€” β€” β€” β€” β€” β€” β€” β€” β€” -

That’s All

Thank You so much for giving your Valueable Time.

-Aditya Jain-

β€” β€” β€” β€” β€” β€” β€” β€” β€” β€” β€” β€” β€” β€” β€” β€” β€” β€” β€” β€” β€” β€” β€” β€” β€” β€” β€” β€” β€” β€” β€” β€” β€” β€” β€” β€” β€” β€” β€” β€” β€” β€” β€” β€” β€” β€” β€” β€” β€” β€” β€” β€” β€” β€” β€” -

--

--