Create Machine Learning Model on Docker container image on centos
What do you mean by Docker?
Docker is everywhere in the software industry in today’s world. Mostly popular as a DevOps tool, Docker has stolen the hearts of many developers, system administrators, and engineers, among others. Docker is a tool that helps users to exploit operating-system-level virtualization to develop and deliver software in packages called containers.
Components of Docker
- Docker Engine
- Docker Client
- Docker Machine
- Docker Hub
- Docker Desktop
-> Docker Image: Docker images have intermediate layers that increase reusability, decrease disk usage, and speed up docker build
by allowing each step to be cached. These intermediate layers are not shown by default.
docker images [OPTIONS] [REPOSITORY[:TAG]]
-> Docker Container: A Docker container image is a lightweight, standalone, executable package of software that includes everything needed to run an application: code, runtime, system tools, system libraries, and settings. Container images become containers at runtime and in the case of Docker containers — images become containers when they run on Docker Engine.
docker container COMMAND
Installing Docker
- Login with root account and go to cd /etc/yum.repos.d/
2. Create a file for the docker repo like docker12.repo
3. Copy and paste the following command in a text file
[docker]
baseurl=https://download.docker.com/linux.centos.7/x86_64/stable/
gpgcheck=0
name=docker repo
4. Now we will command
yum repolist
5. Now we will install docker-ce
yum install docker-ce — nobest
6. Now we will restart the docker service
systemctl restart docker
systemctl enable docker
7. Install centos
docker pull centos:8
Deploying Model on centos container
- Create centos container
2. Start the docker container
docker start mycont
docker ps
3. Now we will attach the container in docker
docker attach mycont
4. Now we will install python software on top of the docker container
yum install python38 git
5. Now git clone the python code
git clone <repolink>
6. We will set up the environment by installing all requirements
7. Finally, we will run the code
python detect.py
With this, we successfully deployed the python model in the centos container