Task 01 👨🏻💻
Task Description 📄
👉 Pull the Docker container image of CentOS image from Docker Hub 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 Jupiter notebook
What is docker?
Docker is an open-source project for automating the deployment of applications as portable, self-sufficient containers that can run on the cloud or on-premises.
Why we need it?
The Docker container image includes only what your app needs to run. If your app makes use of Nginx and Node.js, the container image will include them, but you won’t be burdened with all the other userland apps you’d generally find on Linux.
Let’s install docker on instance
yum install docker -y
Now docker is installed start it and enabled to use there services
systemctl enable docker --now
now let’s install centos image from
docker pull centos
To verify weather image get downloaded or not use command:
Now let’s run docker container with downloaded image.
docker run -it --name os1 centos
To verify running container use command:
Now we are in terminal of os1 so now let’s first install git to install our code from repository.
Here you can see that repository was successfully cloned now let’s install python3 package. command:
yum install python3 -y
Here inside the repository I had created requirements file which will download all required python modules and libraries for us. So to install this use command:
pip3 install -r requirements.txt
Now it’s time to run startup_model_code.py file so that it will create model in our local directory.
Now Here file named startupmodel.pk1 is created successfully. So to run this model and predict salary use run.py file.
Yeah it’s giving pretty good accuracy.
So Here we discussed about how to install docker, How to create separate environment to run all the code? and How to run our Machine learning code inside docker container?
Thanks for reading… If any questions please feel free to leave a comment below and Do connect with me on these platforms.
- Mail: email@example.com
- LinkedIn: https://www.linkedin.com/in/yash-panchwatkar/
Stay tuned for such awesome stories!