Learn Python

Learn Data Structure & Algorithm

Learn Numpy

Learn Pandas

Learn Matplotlib

Learn Seaborn

Learn Statistics

Learn Math

Learn MATLAB

Learn Machine learning

Learn Github

Learn OpenCV

Learn Deep Learning

Learn MySQL

Learn MongoDB

Learn Web scraping

Learn Excel

Learn Power BI

Learn Tableau

Docker Introduction

Docker File, Image & container

Docker using with ml-model

Learn Hadoop

How use docker for machine learning model

Let's use docker in machine learning model

Suppose you have created a machine learning model and we know that to create data science work we use anconda3 navigator. We use this because there we have all the needed packages to create a data science project. In docker we manually write commands to install the needed packages. But if the project is huge then it can possible somehow we can miss any package or we can get some error while installing the packages. So what we can do is that, because in anaconda navigator we have all the needed packages, so if we use anaconda navigator docker image to deploy the model then we will not face any problem because all the needed things are already present in the anaconda navigator.
To get an anaconda navigator image, go to dockerhub.com and search for continuumio/anaconda3. This is the image for anaconda navigator.




Copy the command given in the green marked area. This is the command for the anaconda navigator docker image. Copy the command and execute it in the command prompt.

Step 1:
Now open the command prompt and copy the command and paste it and execute it. Here you don't need to go to any directory to execute this command. Just open from the search bar and execute the command.
After downloading to see the image,
run command:
docker images

Step 2:
Now create docker file:
We will use continuumio/anaconda3:latest as base image
First command:
FROM continuumio/anaconda3:latest

Now we have to select directory.
Command:
WORKDIR /home

Now we have to copy our data science project file and have to paste it into the working directory. Here our directory is the home directory because we select it in the second step.
Command:
COPY House_price_prediction .

Let's create see the docker file




Step 3:
Now let's create docker image
Command:
docker build -t mydoc:pypac .

Step 4: Now let's run the docker image
Command:
docker run -it --name myimg -p 8888:8080 mydoc:pypac

Here 8888(you can use any port number ) is the our or host system port and 8080(you have to mention this port number in your flask or django .py file where you wrote the code. You can use any port number) is docker port.

Let's see the docker images:
Command:
docker images

CodersAim is created for learning and training a self learner to become a professional from beginner. While using CodersAim, you agree to have read and accepted our terms of use, privacy policy, Contact Us

© Copyright All rights reserved www.CodersAim.com. Developed by CodersAim.