Featured

Integrating "linux command" and "docker" with "AI" enabled Python Code

Hello friends,

I hope you all are good, as we all know today our world is growing like "bamboo plant" in terms of technologies , and this becomes very important to us too ,to grow with it if we want to become successful in any domain related to tech, day by day we come in interaction with very amazing and useful technologies , such powerful technologies which we have never even thought about.

This all becomes possible in this rapid growing world , only with the help of some powerful tools that we see these wonders around us.
Great innovators who are working day and night to make something very realistic to help humankind
has totally changed the world in a better way.

AI, Machine Learning, DevOps, Python and the beauty of Linux have helped in every aspect, to make everything possible whatever we can think of .

Today my article is all about becoming an "Innovator" rather than working on pre existing technologies our whole life, So when we are thinking of building something new we should have a great knowledge of pre-existing Tools which are being used to solve some great use cases .

To kick start your interest in World's best technologies today i am gonna show you very beautiful use case to solve one industry problem.

Integration of  "linux command" and "docker" with AI enabled Python Code 

So, first we will configure a web server inside a docker container to do so we have to install Docker in our system, here i am using Redhat8 (linux) you guys can use any other distro of linux to setup this configuration.

To install Docker in Redhat8 follow these steps :
1. Open the terminal
2. Type the following command to install Docker via "yum" provided by Red Hat:
     `sudo yum install docker`
3. Type the following command to install the latest version of Docker CE (community edition):
    `sudo yum remove docker docker-common docker-selinux docker-engine`
    `sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo`
     `sudo yum install docker-ce`
  after installing Docker to check if docker is installed successfully or not
  run command `systemctl status docker`
  this will give output something like this




first of all start docker services to do so run `systemctl start docker`

now to run new container run command `docker images` to see available containers






then to run any of them use : `docker container run -it --name osname imagename:version`
(i am running my pre-configured webserver image.)

now you'll be having a new fresh operating system now we have to install apache web server into this Os to do so first install httpd by the suitable command used in the particular Os you have launched inside docker.

now after installation of  httpd start httpd service inside docker to do so just run `httpd` inside container, after this head towards the folder "cd  /var/www/html"



Now create a file index.html inside this folder and now as you will be able ping your base Os form docker container and vice versa.



now we can configure this OS to automatically start httpd services by adding
 "rm -fr /var/run/httpd/*
/usr/sbin/httpd"
these two line inside "/root/.bashrc" as shown in picture below




now we will write a python code so that when ever we need to install more than one webserver we will do so by our face id just simpy running command  `docker container run webserver:v1`
whenever we bring our face in front of  webcam one new web server will be launched automatically.

without our more work a new web server will be ready in just few seconds, this is the power of AI and DevOps , we should use this to solve many use case and to manage time and be productive.

so, whenever you feel like that load on the existing web server is increasing we can simply launch new web server very quick , without loosing trust of our customer and our reputation.



By Deepanshu Mishra
deepanshusuper16@gmail.com

Comments