Pull the Docker container image of CentOS image from DockerHub and create a new container:
Launching the redhat OS
Step 2: Checking the status of docker using the command
systemctl status docker
Make sure that docker is installed.
Pulling centos ( latest version ) on docker container. Command for it is
docker pull centos:8
Launching an OS on docker
docker run -it centos:8 # This command means launching an OS ( centos ) on docker ( as a container ). This OS gets a garbage name. To assign a name , following command can be used docker run -it --name myos centos:8 #Here the name of the OS , launched is myos
The OS is successfully launched. To confirm it , the tag is changed from [ root@localhost ~ ] to [ root@ idno ~ ]
Apart from this , we also can check the containers by using the following command in new window terminal.
Here in this image, there were two containers launched. Here the two containers were launched successfully on docker containers on top of centOS image.
Installing python on docker container:
To install python on docker container, the following command is used ( making sure that linux OS has active internet connection )
Press y again
Python is successfully installed on docker container.
Creating ML model on docker:
For this we need to install few libraries on container. Pandas is the important most library , to install it , command line is
pip3 install pandas
Next library is scikit-learn, command for this is
pip3 install scikit-learn
Now Let’s create a python file , command line is
And press i to write code
Once the code is completed return back
Now run the python file using the command