Training a ML Model usin Docker Container
Description:
- Pulling a Docker image of CentOS from DockerHub and creating a new container.
- Launching the Docker container.
- Installing Python on top of the Docker container.
- Installing the required libraries for the machine learning model.
- Creating and running the Python code, and getting the desired output.
STEP 1:
- The first step is to check whether Docker is installed in the system or not. For installing Docker the command used is:- "yum install docker-ce".
- Checking the status of Docker if it's running or not, the command used is:- "systemctl status docker".
- Then pulling the Docker image of CentOS from DockerHub and creating a container.
- For launching the container the command used is:- "docker run -it --name <CONTAINER_NAME> <OS_NAME>:<version>".
STEP 2:
- Installing Python on top of the docker container using the command:- "yum install python 3".
STEP 3:
- Copying the data set from the local host (Base OS) to the Docker container on which we train the ML model.
- The command used for the above stated step is:- "docker cp <file_name> <container_name>:<dest>"
- Starting the container in Docker using the command:- "docker start <container_name>".
STEP 4:
- Installing the required libraries to load the Machine Learning model, the command used to install these libraries is:- "pip3 install <library_name>".
- Creating the Python code for prediction using Linear Regression.
- The output of the Machine Learning model:
I hope that this article helps in gaining an insight of how to train a ML model on Docker, and if there is any feedback please feel free to reach out.
Thank You.