<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Krishna Pal on Medium]]></title>
        <description><![CDATA[Stories by Krishna Pal on Medium]]></description>
        <link>https://medium.com/@krishnapal3sep?source=rss-170805c84ad1------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*hruRYqTCFUT-BxWg</url>
            <title>Stories by Krishna Pal on Medium</title>
            <link>https://medium.com/@krishnapal3sep?source=rss-170805c84ad1------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 22 Nov 2026 00:39:56 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@krishnapal3sep/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Automating Jenkins Jobs using Build Pipeline inside Docker Container with the help of Dockerfile]]></title>
            <link>https://krishnapal3sep.medium.com/automating-jenkins-jobs-using-build-pipeline-inside-docker-container-with-the-help-of-dockerfile-7b286ef6b3b9?source=rss-170805c84ad1------2</link>
            <guid isPermaLink="false">https://medium.com/p/7b286ef6b3b9</guid>
            <category><![CDATA[pipeline]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[jenkins]]></category>
            <category><![CDATA[dockerfiles]]></category>
            <dc:creator><![CDATA[Krishna Pal]]></dc:creator>
            <pubDate>Sat, 02 Oct 2021 17:41:46 GMT</pubDate>
            <atom:updated>2021-10-02T17:41:46.039Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/995/1*-wWxIA0VK4hSWqKQUb2q0Q.png" /></figure><p>In this blog, I will be <strong>automating</strong> the Jenkins inside a <strong>docker container</strong> with the help of <strong>Dockerfile</strong> and then <strong>create </strong>and <strong>execute</strong> different <strong>Jenkins job</strong> running inside a container.</p><p><strong>⚡Task Description⚡</strong></p><p><strong>1. Create container image that’s has Jenkins installed using DockerFile</strong></p><p><strong>2. When we launch this image, it should automatically starts Jenkins service in the container.</strong></p><p><strong>3. Create a job chain of job1, job2, job3 and job4 using build pipeline plugin in Jenkins</strong></p><p><strong>4. Job1 : Pull the GitHub repo automatically when some developers push repo to GitHub.</strong></p><p><strong>5. Job2 : By looking at the code or program file, Jenkins should automatically start the respective language interpreter install image container to deploy code ( eg. If code is of PHP, then Jenkins should start the container that has PHP already installed ).</strong></p><p><strong>6. Job3 : Test your website if it is working or not.</strong></p><p><strong>7. Job4 : if website is not working , then send email to developer with error messages.</strong></p><p><strong>8. Create One extra job job5 for monitor : If container where app is running. fails due to any reason then this job should automatically start the container again.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sDxbrvjS7OYljhivABF46w.jpeg" /></figure><h3><strong>Here we go ⏩</strong></h3><p><strong><em>Firstly we create Dockerfile.</em></strong></p><p><em>👉 First </em><strong><em>create a separate workspace for a Dockerfile . </em></strong><em>I have created a directory named </em><strong><em>jenkinsws</em></strong><em>. In this workspace create a </em><strong><em>Dockerfile</em></strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1002/1*AaNgx_CNvQ279F2BrwUYdw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1010/1*n0hiudgLal9WyKG-QiV-6Q.png" /><figcaption><strong>Dockerfile</strong></figcaption></figure><p><strong>⏩<em> Build a Dockerfile</em></strong></p><pre>docker build -t &lt;image_name&gt;:&lt;tag&gt; /workspace</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/865/1*i-0tYzfJbG8RENReHcpeoA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/860/1*PGaiENyT9D0Y50qGn7_ipw.png" /><figcaption><strong>docker images</strong></figcaption></figure><p>⏩<strong><em> So let’s launch the Docker container</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ogacdJkmY4tinPU-4YyJMg.png" /></figure><p><em>Launching docker container will automatically starts </em><strong><em>jenkins service.</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*l-7wsnkj8tSm0T6vUk701g.png" /></figure><p><em>Here we got the </em><strong><em>initial password </em></strong><em>of jenkins. This is needed to unlock Jenkins for the first time.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*h3IsipP_c6D3Xhl9ap7esg.png" /></figure><p><em>Now install suggested plugins. As we can see </em><strong><em>plugins start downloading</em></strong><em>…👇</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/987/1*URstpSGkBtCHdU3NxQvsaA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/992/1*nJAiNICVQGwO9CiRXDL_Qg.png" /></figure><p><em>👉 Here we create </em><strong><em>username and password</em></strong><em> for login to jenkins.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/992/1*nJAiNICVQGwO9CiRXDL_Qg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*lM3CUt6QAeLdJI16.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xsCablJbSNw1s8gDZhbVDw.png" /></figure><p><strong><em>Bravo!! So our jenkins setup is ready to use.. ✌</em></strong></p><p>⏩<strong> <em>First , Create a new GitHub repo , so that we can put GitHub url in jenkins job..</em></strong></p><h3>🔰Create Job 1</h3><p><strong><em>This job will pull the GitHub repo automatically when some developer pushes repo to GitHub.</em></strong></p><p>👉<em> First give your GitHub repository URL in the </em><strong><em>Source Code Management.</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qABewLsrN6x-8hdzZSp1jA.png" /></figure><p>👉<em> Now In Build Triggers section , select </em><strong><em>GitHub hook trigger for GITScm polling</em></strong><em> , so that only when there is change in GitHub code ,</em><strong><em> jenkins job will automatically start</em></strong><em>.</em></p><p>👉 <em>Next this is the code which gonna help to copy our files from </em><strong><em>Jenkins Workspace </em></strong><em>to our</em><strong><em> </em></strong><em>desired folder</em><strong><em>.</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OXBQsVOerKt_f_ye8aQW4A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QXgTHIJIqSRi9jXCnQbX-A.png" /><figcaption><strong>Console output of Job1</strong></figcaption></figure><p><strong><em>Our job1 is run successfully. </em></strong>✌</p><h3>🔰Create Job 2</h3><p><strong><em>By looking at the code or program file, Jenkins should automatically start the respective language interpreter install image container to deploy code ( eg. If code is of PHP, then Jenkins should start the container that has PHP already installed ).</em></strong></p><p>👉This job will be <strong>Triggering</strong> after job build of job 1, so In <strong>Build Triggers</strong> select <strong>Build after other projects are built</strong> and in <strong>Projects to watch </strong>, put <strong>job1</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*w6bzvLjDIPK-B-aBcD1Olg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hQVjNplfm3FL6QXRsPPbhQ.png" /><figcaption><strong>Console output of job2</strong></figcaption></figure><p><strong><em>So , job2 is successfully done </em>✌</strong></p><h3>⏩ Create Job 3</h3><p><strong><em>job3 will check whether our website is running or not.</em></strong></p><p><em>This job will be </em><strong><em>Triggering</em></strong><em> after job build of job 2, so In </em><strong><em>Build Triggers</em></strong><em> select </em><strong><em>Build after other projects are built</em></strong><em> and in </em><strong><em>Projects to watch </em></strong><em>, put </em><strong><em>job2</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3uUKjs2DZmSbb8PkVitlDw.png" /></figure><p>👉 <em>Now the below script will check whether our website is giving 200 status code or not. </em><strong><em>Status code 200 means the website is working fine.</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PkvJWKSpNihr18UX2oUZdA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Jzxap3on0xzMvanOPpmniw.png" /><figcaption><strong>Console output of job3</strong></figcaption></figure><p><strong><em>So , job3 is successfully done </em>✌</strong></p><h3>⏩ Create Job 4</h3><p><strong><em>if website is not working , then send email to developer with error messages.</em></strong></p><p>👉<em> This job will be </em><strong><em>Triggering</em></strong><em> after job build of job 3, so In </em><strong><em>Build Triggers</em></strong><em> select </em><strong><em>Build after other projects are built</em></strong><em> and in </em><strong><em>Projects to watch </em></strong><em>, put </em><strong><em>job3.</em></strong></p><p><em>Now this script will first check if our website is </em><strong><em>not giving 200 status code </em></strong><em>then </em><strong><em>it will send email(notification to the developer)</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-48TCYE0Kc140rhrD_v1nQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5Ugmri_6T9mGSFf5DlI87w.png" /><figcaption><strong>Console output of job4</strong></figcaption></figure><p><strong><em>So , our job4 is successfully done </em>✌</strong></p><h3>⏩ Create Job 5</h3><p><strong><em>This job is used for monitoring the docker container. If our container failed at any time then this job will launch the container again.</em></strong></p><p>👉 <em>In Build periodically trigger- give “* * * * * *” . This “</em><strong><em>* * * * *</em></strong><em>” means that jenkins will check the </em><strong><em>docker container </em></strong>every minute of every hour through out the year.<strong><em> </em></strong><em>If our container failed at any time then this job will launch the container again.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kIrOPD7BKCT5Mmoa6pWUBA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6BAxaVCQCQpWXkNCm5fHlA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LTV4WHJiOeCc9miXzQV4zA.png" /><figcaption><strong>Console output of job5</strong></figcaption></figure><p><strong><em>So , our job5 is successfully done </em>✌</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oPZCX5tXiVemhRHS5EeJog.png" /><figcaption><strong>All 5 jobs run successfully</strong></figcaption></figure><p><strong><em>Finally all the jobs are completed now let’s create build pipeline</em></strong></p><h3>⏩ Create a Build Pipeline</h3><p>👉For making a build pipeline <strong>first install the Build pipeline plugin.</strong></p><p>👉Then click on <strong>New view </strong>to a add a pipeline.</p><p>👉Give a name and <strong>Enable the Build pipeline view option and </strong>Select initial job as <strong>Job 1</strong></p><h3>Now let’s see our pipeline :</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MhCCyPa88OJgoSmYmgAbPw.png" /></figure><p><strong><em>👉</em></strong><em> Now go to the website and type the web address of our server and will see the page working fine.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ko5Xdpo2CjHduHkIjxHv_A.png" /><figcaption><strong>Website is working fine..</strong></figcaption></figure><p>👉 <em>Now let’s check by making a mistake in the</em><strong><em> php code</em></strong><em>. So, now I pushes the wrong code.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MQuNX11aq_zJ-TYDYEonNA.png" /><figcaption><strong>wrong php code</strong></figcaption></figure><p><strong><em>👉 Now you will see that job3 will automatically failed.</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mXrsZH4DISGnS_KxuXBx4Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qOZ4HomaqbnSfN80oz1GPw.png" /></figure><p><em>👉 Now go to the page you will see that it’s not </em><strong><em>working</em></strong><em>.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tEPrxXoW5KQkgjCa1h84Ag.png" /><figcaption><strong>Page not loaded</strong></figcaption></figure><p><strong><em>Hurray!! we successfully completed all the given task</em></strong>. 😊✌</p><h3>Thanks For Reading…<strong>💙</strong></h3><p>📌<strong>Here is my GitHub Repo Link:-</strong></p><p><a href="https://github.com/Krishna3-cloud/Jenkins-Task2">GitHub - Krishna3-cloud/Jenkins-Task2</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7b286ef6b3b9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Integrating Jenkins with GitHub and Docker]]></title>
            <link>https://krishnapal3sep.medium.com/integrating-jenkins-with-github-and-docker-e8270e6ad05a?source=rss-170805c84ad1------2</link>
            <guid isPermaLink="false">https://medium.com/p/e8270e6ad05a</guid>
            <category><![CDATA[jenkins]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[github]]></category>
            <dc:creator><![CDATA[Krishna Pal]]></dc:creator>
            <pubDate>Wed, 01 Sep 2021 21:40:02 GMT</pubDate>
            <atom:updated>2021-09-01T21:40:02.877Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GxmTEWTkGF8mqoATocSDrg.png" /></figure><p><strong>🔰TASK DESCRIPTION🔰</strong></p><p><strong>JOB#1: </strong>If a Developer pushes their code to dev branch then <strong>Jenkins</strong> will fetch from dev and deploy on dev-docker environment.</p><p><strong>JOB#2: </strong>If Developer push to master branch then <strong>Jenkins</strong> will fetch from master and deploy on master-docker environment.</p><p><strong>JOB#3: Jenkins</strong> will check (test) for the website running in the dev-docker environment. If it is running fine then <strong>Jenkins</strong> will <strong>merge</strong> the dev branch to master branch and <strong>trigger</strong> <strong>JOB#2.</strong></p><p><strong>Let’s Begin⚡</strong></p><p>Make a repository on GitHub first ⏩</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pmx5cNhFPnvM6Y13uZlsuQ.png" /></figure><p>Now Uploading file in Master branch ⏩</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ruiSygnXkDmOviHS3GJllw.png" /></figure><p>Now change the branch type: <strong>git checkout dev. </strong>Now, all the codes from master branch are present in the dev branch.</p><p>Now upload files in dev branch</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Pc9Ansdm6fOhsQxiQC43Eg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kjFACbg-1W07_1VS5BT9yg.png" /><figcaption>dev branch</figcaption></figure><p><strong>Now, we have set up 2 branches in GitHub successfully 😀</strong></p><h3><strong>Now it’s time to start Jenkins</strong></h3><p>I am using RHEL8 OS to start Jenkins</p><pre><strong><em>Command:</em></strong><em> systemctl start jenkins</em></pre><p>Type <strong>RHEL8 IP</strong> and <strong>port no. 8080</strong> in <strong>BROWSER</strong> , <strong>login</strong> with as username and password.</p><h3><em>Next move, Job Creation👨‍💻</em></h3><p><strong><em>⏩ For JOB-1</em></strong></p><ol><li><em>Select </em><em>new item option from the Jenkins menu.</em></li><li><em>Assign a name to the Job ( Here, </em><em>JOB-1 )and select </em><em>Freestyle project.</em></li><li><em>Configure Job option, set the configurations….</em></li><li><em>In</em><strong><em> Source Code Management</em></strong><em> section, we select Git and mention the URL of our GitHub Repository and select the branch as </em><em>dev.</em></li><li><em>In the </em><strong><em>Build Triggers</em></strong><em> section, select </em><em>GitHub hook trigger for GITScm polling</em></li><li><em>In the </em><strong><em>Build</em></strong><em> Section, type the following script in </em><strong><em>Execute Shell section</em></strong><em>:</em></li></ol><pre><em>if sudo docker ps | grep dev_os<br>then<br>echo &quot;dev is already Running&quot;<br>else<br>sudo docker run -d -i -t  -p 8081:80 -v /devws:/usr/local/apache2/htdocs/ --name dev_os httpd<br>fi</em></pre><pre><em>sudo cp -rvf * /devws</em></pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uU9lA5oA9H9fEbcVC-Ik9g.png" /><figcaption><strong>JOB-1</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RXW_V211Fxz4ouwjH3nZ9g.png" /></figure><p>7.<em> Now save the job by clicking</em><strong><em> Save</em></strong><em> button.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aJzvfWrpIiQcbvINfPdBNw.png" /><figcaption><strong>Console Output of Job-1</strong></figcaption></figure><p>Bravo!!!… Job-1 run successfully 😃</p><p><em>⏩ </em><strong><em>For JOB-2</em></strong></p><ol><li><em>Select </em><em>new item option from the Jenkins menu.</em></li><li><em>Assign a name to the Job ( Here, </em><em>JOB-1 )and select </em><em>Freestyle project.</em></li><li><em>Configure Job option, set the configurations….</em></li><li><em>In</em><strong><em> Source Code Management</em></strong><em> section, we select Git and mention the URL of our GitHub Repository and select the branch as </em><em>dev.</em></li><li><em>In the </em><strong><em>Build Triggers</em></strong><em> section, select </em><em>GitHub hook trigger for GITScm polling</em></li></ol><p><em>6. In the </em><strong><em>Build</em></strong><em> Section, type the following script in </em><strong><em>Execute Shell Section</em></strong><em>:</em></p><pre><em>if sudo docker ps | grep master_os<br>then<br>echo &quot;master is already Running&quot;<br>else<br>sudo docker run -d -i -t  -p 8082:80 -v /Masterws:/usr/local/apache2/htdocs/ --name Master_os httpd<br>fi<br>sudo cp -rvf * /Masterws</em></pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8SuEExkgvMB86rEsa9cI7Q.png" /><figcaption><strong>JOB-2</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*glaXPAkXVbhXJcozIV874g.png" /></figure><p>7.<em> Now save the job by clicking</em><strong><em> Save</em></strong><em> button.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*C0ByThD92mLDNTkJj0mlQQ.png" /><figcaption><strong>Console Output of Job-2</strong></figcaption></figure><p>Bravo!!!… Job-2 run successfully 😃</p><p><strong><em>⏩ For JOB-3</em></strong></p><ol><li><em>Select </em><em>new item option from the Jenkins menu.</em></li><li><em>Assign a name to the Job ( Here, </em><em>JOB-3 )and select a </em><em>Freestyle project.</em></li><li><em>In </em><em>Configure Job option, set the configurations…</em></li><li><em>In the </em><strong><em>Source Code Management</em></strong><em> section, select Git and mention the URL of our GitHub Repository and select the branch to build as </em><em>dev.</em></li><li><em>In</em><strong><em> Additional Behavior , </em></strong><em>select </em><em>Merge Before Build</em></li><li><em>set the </em><strong><em>Name of the Repository</em></strong><em> as </em><em>origin, Set the </em><strong><em>Branch to Merge to</em></strong><em> as </em><em>master</em></li><li><em>In</em><strong><em> Post Build Actions</em></strong><em> ,select </em><strong><em>Git Publisher , </em></strong><em>check </em><strong><em>Push only if the build succeeds</em></strong><em> and </em><strong><em>Merge Results</em></strong><em> options.</em></li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*khuFs81GT75lFEKuZRYFlQ.png" /><figcaption><strong>JOB-3</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*w-QUoWSczVQLbqbJPAaxfA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LBpAWBScO46apMp9seqGCA.png" /></figure><p>Now Save the <strong>Job-3.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Q95g1U-r_Ol3kGGSehF6mQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VsGlYor0CEDY8FMbPho_uA.png" /><figcaption><strong>Console Output of Job-3</strong></figcaption></figure><p>Hurray!!! Job-3 run successfully…. 😍</p><p>😎 Now let’s cross check the merge status</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/747/1*vbVDLFJ62qxu4x1RLpsAcg.png" /><figcaption><strong>Merge Status</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fBrYbzifVoRcuJTAqUa-Dw.png" /><figcaption><strong>All three jobs run successfully</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*h01dESPWgkyeO4I6VW9dOQ.png" /><figcaption><strong>docker container status</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hcGXYFtLxwMvhZcfZ3JBag.png" /><figcaption><strong>dev branch code</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Imjjk_lLd5XuUvoMTr35Aw.png" /><figcaption><strong>Master branch code</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wmJ3R3dJE4jeztqgFulTfQ.png" /><figcaption><strong>webpage after merged code</strong></figcaption></figure><p>So, Our Task has been done successfully… 😉✌</p><h3>Thanks for reading… 📃</h3><p><strong>GitHub Link:- </strong><a href="https://github.com/Krishna3-cloud/Jenkins-Task1.git">https://github.com/Krishna3-cloud/Jenkins-Task1.git</a></p><p><a href="https://github.com/Krishna3-cloud/Jenkins-Task1.git">GitHub - Krishna3-cloud/Jenkins-Task1</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e8270e6ad05a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[K-mean Clustering and its real use-case in the security domain]]></title>
            <link>https://krishnapal3sep.medium.com/k-mean-clustering-and-its-real-use-case-in-the-security-domain-c1a29c3b7ef3?source=rss-170805c84ad1------2</link>
            <guid isPermaLink="false">https://medium.com/p/c1a29c3b7ef3</guid>
            <category><![CDATA[security]]></category>
            <category><![CDATA[clustering-algorithm]]></category>
            <category><![CDATA[k-means-clustering]]></category>
            <category><![CDATA[clustering]]></category>
            <dc:creator><![CDATA[Krishna Pal]]></dc:creator>
            <pubDate>Mon, 19 Jul 2021 14:43:42 GMT</pubDate>
            <atom:updated>2021-07-19T14:43:42.063Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9cOlU6s_lcRoAzQIeVun3g.png" /></figure><h3><strong>K-means Clustering:-</strong></h3><p><em>K-Means is one of the most popular “clustering” algorithms. K-means stores $k$ centroids that it uses to define clusters. A point is considered to be in a particular cluster if it is closer to that cluster’s centroid than any other centroid.</em></p><p><em>K-Means Clustering is part of a group of learning algorithms called unsupervised learning. In this type of learning model, there is no clear identification of the label / category / category for each data point.<br>Each point of data in your database is a vector of symbols, that is, features without a specific label that it can assign to a particular set or category. The algorithm will learn on its own how to collect data points with similar features and collect them together.</em></p><p><em>K-Means finds the best centroids by alternating between (1) assigning data points to clusters based on the current centroids (2) choosing centroids (points which are the center of a cluster) based on the current assignment of data points to clusters.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/501/0*hdWboUlEeKvuBcXF.png" /><figcaption><em>Figure 1: K-means algorithm. Training examples are shown as dots, and cluster centroids are shown as crosses. (a) Original dataset. (b) Random initial cluster centroids. (c-f) Illustration of running two iterations of k-means. In each iteration, we assign each training example to the closest cluster centroid (shown by “painting” the training examples the same color as the cluster centroid to which is assigned); then we move each cluster centroid to the mean of the points assigned to it.</em></figcaption></figure><h3>Implementation of K Means Clustering:-</h3><p><strong><em>Step 1:</em></strong><em> Let’s choose the k number of groups, that is, K = 2, to divide the data into categories. We will select two random points that will serve as the centroid to build the collection.</em></p><p><strong><em>Step 2: </em></strong><em>We will now allocate each data point to the distribution structure based on its distance from the nearest K-point or centroid. It will be done with a drawing between the two centroids.</em></p><p><strong><em>Step 3:</em></strong><em> points on the left side of the line next to the blue centroid, and the points on the right of the line are closer to the yellow centroid. A collection of left Form One with blue centroid and right with yellow centroid.</em></p><p><strong><em>Step 4: </em></strong><em>Repeat the process by selecting a new centroid. To select new centroids, we will find a new magnetic field for these centroids, shown below:</em></p><p><strong><em>Step 5:</em></strong><em> Next, we will redistribute each data point to the new centroid. We will repeat the same process as above (using the middle line). The yellow data point on the blue side of the center line will be included in the blue set</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/403/0*STVBV-I-9yhSrSSc.png" /></figure><p><strong><em>STEP 6: </em></strong><em>As redistribution has occurred, so we will repeat the above step to get new centroids.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/403/0*yTOZTOiRZiEPQt8V.png" /></figure><p><strong><em>STEP 7: </em></strong><em>We will repeat the above process of finding the center of gravity for centroids, as outlined below:</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/403/0*rNXoBX88CkDjrfQU.png" /></figure><p><strong><em>STEP 8: </em></strong><em>After discovering the new centroids we will re-draw the center line and refresh the data points, as in the steps above.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/403/0*iA3W6-YvOBJmaJbf.png" /></figure><p><strong><em>STEP 9:</em></strong><em> Finally we will divide the points based on the middle line, such as that two groups are formed and no different point will be assigned to one group</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/0*tzty7x_NRuwdDJNP.png" /></figure><blockquote>The last Cluster built is as follows:</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/0*mAQnsr1nuXAmHfSA.png" /></figure><h4>Choosing the Right Collection Number:-</h4><p><em>The number of collections we choose for the algorithm should not be random.</em></p><p><em>Each collection is made up of a calculation and comparison of the standard distances of each data point within a collection from its centroid.</em></p><p><em>We can select the appropriate number of collections with the help of the Within-Cluster-Sum-of-Squares (WCSS) method.</em></p><p><em>WCSS represents the total number of squares of data points in each collection from its centroid.</em></p><p><em>The main idea is to reduce the distance between data points and centroid collections. The process is written until we reach the minimum number of distances.</em></p><h3><strong>Real Use-Case in Security Domain:-</strong></h3><h4>Cyber-Profiling Criminals</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/900/1*UD3-p3UJlM2do1z0JhLNOw.jpeg" /></figure><p><em>The process of criminalizing criminals is often referred to as the investigation or analysis of cyber-crime profiling crime. Crime profiles are generated in the form of data by personal characteristics, trends, habits, and geographic characteristics of the offender (e.g.: age, gender, socio-economic status, education, location). The correction of criminal profiles will be accompanied by an analysis of the physical evidence available at the scene, the process of extracting the victim’s (victim’s) disclosure, finding a way to work (whether the crime is planned or unplanned), and the process of deliberately excluding perpetrators (signature).</em></p><p><em>The new approach to cyber profiling is to use </em><strong><em>k-means</em></strong><em> </em><strong><em>clustering techniques</em></strong><em> to classify the Web-based content through data user preferences. This preference can be interpreted as an initial grouping of the data so that the </em><strong><em>resulting cluster </em></strong><em>will show user profiles.</em></p><p><em>User installation can be seen as a result of user interests, goals, features, behavior and preferences. User profiles are designed for user background information. The user profile represents a concept model held by the user when searching for web information.</em></p><p>Thanks for Reading.. 😍</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c1a29c3b7ef3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[JavaScript and its Use-Case in Spotify]]></title>
            <link>https://krishnapal3sep.medium.com/javascript-and-its-use-case-in-spotify-d002b039766c?source=rss-170805c84ad1------2</link>
            <guid isPermaLink="false">https://medium.com/p/d002b039766c</guid>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[spotify]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[music]]></category>
            <category><![CDATA[api]]></category>
            <dc:creator><![CDATA[Krishna Pal]]></dc:creator>
            <pubDate>Wed, 23 Jun 2021 05:16:00 GMT</pubDate>
            <atom:updated>2021-06-23T05:16:00.359Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-NuTkyhn9dKCgc7AvYuFrA.png" /></figure><h3><em>Introduction of Spotify:-</em></h3><p><em>Spotify is a Swedish audio streaming and media services provider founded in 2006 by </em><strong><em>Daniel Ek</em></strong><em>. It is one of the world’s largest music streaming service providers, with over 356 million monthly active users, including 158 million paying subscribers, as of March 2021. Spotify offers digital copyright restricted recorded music and podcasts, including more than 90 million songs, from record labels and media companies. As a freemium service, basic features are free with advertisements and limited control, while additional features, such as offline listening and commercial-free listening, are offered via paid subscriptions. Users can search for music based on artist, album, or genre, and can create, edit, and share playlists.</em></p><h3>What is JavaScript?</h3><p>JavaScript is a cross-platform, object-oriented scripting language used to make webpages interactive (e.g., having complex animations, clickable buttons, popup menus, etc.). There are also more advanced server side versions of JavaScript such as Node.js, which allow you to add more functionality to a website than downloading files (such as realtime collaboration between multiple computers). Inside a host environment (for example, a web browser), JavaScript can be connected to the objects of its environment to provide programmatic control over them.</p><p>JavaScript contains a standard library of objects, such as Array, Date, and Math, and a core set of language elements such as operators, control structures, and statements. Core JavaScript can be extended for a variety of purposes by supplementing it with additional objects; for example:</p><ul><li><em>Client-side JavaScript</em> extends the core language by supplying objects to control a browser and its <em>Document Object Model</em> (DOM). For example, client-side extensions allow an application to place elements on an HTML form and respond to user events such as mouse clicks, form input, and page navigation.</li><li><em>Server-side JavaScript</em> extends the core language by supplying objects relevant to running JavaScript on a server. For example, server-side extensions allow an application to communicate with a database, provide continuity of information from one invocation to another of the application, or perform file manipulations on a server.</li></ul><p>This means that in the browser, JavaScript can change the way the webpage (DOM) looks. And, likewise, Node.js JavaScript on the server can respond to custom requests from code written in the browser.</p><h3>How Spotify uses JavaScript?</h3><p><em>JavaScript is used across the Spotify desktop client. Wherever UI is concerned, it uses JavaScript. C++ is used for functionality beneath the UI, with JavaScript sitting on top of it. The languages are connected by an interface aptly called a ‘bridge.’ Spotify Interface using Chromium Embedded Framework. The interface layer called Cosmos is a perfect bridge between C++ and JavaScript and hence, interacting with different views in no more a trouble for the developers. On top of that, there is a layer of PHP that mainly executes the logging in and some apps on different domains. The rest of the part is JavaScript as far as the overall interface is concerned. JavaScript uses a specialized C++ service to ace to the backend.</em></p><p><em>JavaScript helps in fetching songs based on type of Artist, Recent listening, Artist Collection, Your own built playlist, New Releases, Today’s Recommendation and much more. As whatever song you want to listen, your queries renders JavaScript category selection function, event listener function and many more function to display results according to that. JavaScript also has use case in authorization access flow in Spotify.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bnTjFUeiDko_HjrI8fQdWA.png" /><figcaption><strong>JavaScript work architecture in Spotify</strong></figcaption></figure><p><em>Node-js an open-source, cross-platform, back-end JavaScript runtime environment that runs on the V8 engine and executes JavaScript code outside a web browser. Node-js also play an vital role in developing Spotify API.</em></p><blockquote><em>Here is the link for Web API Libraries of Spotify:-</em></blockquote><p><a href="https://developer.spotify.com/documentation/web-api/libraries/">Web API Libraries | Spotify for Developers</a></p><p><em>Thanks for Reading…😊</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d002b039766c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Live Streaming Video Chat App without voice using cv2 module of Python]]></title>
            <link>https://krishnapal3sep.medium.com/live-streaming-video-chat-app-without-voice-using-cv2-module-of-python-64a022523cbc?source=rss-170805c84ad1------2</link>
            <guid isPermaLink="false">https://medium.com/p/64a022523cbc</guid>
            <category><![CDATA[webcam]]></category>
            <category><![CDATA[video-app]]></category>
            <category><![CDATA[python-programming]]></category>
            <category><![CDATA[opencv-python]]></category>
            <category><![CDATA[socket-programming]]></category>
            <dc:creator><![CDATA[Krishna Pal]]></dc:creator>
            <pubDate>Fri, 11 Jun 2021 13:13:43 GMT</pubDate>
            <atom:updated>2021-06-11T13:13:43.254Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WFe7V4a71kvQrDL0r8BX5Q.jpeg" /></figure><h3>What is OpenCV?</h3><p><em>OpenCV is a Python open-source library, which is used for computer vision in Artificial intelligence, Machine Learning, face recognition, etc.</em></p><p><em>In OpenCV, the CV is an abbreviation form of a computer vision, which is defined as a field of study that helps computers to understand the content of the digital images such as photographs and videos.</em></p><p><em>The purpose of computer vision is to understand the content of the images. It extracts the description from the pictures, which may be an object, a text description, and three-dimension model, and so on.</em></p><p><strong>Steps required to build Live Streaming Video Chat App:-</strong></p><p><strong><em>Prerequisite:-</em></strong></p><ol><li><em>Webcam</em></li><li>Any IDE having python extension installed.</li><li>Internet Connection</li></ol><blockquote><em>Here I am using Jupyter Notebook.</em></blockquote><p><strong><em>Required Python Libraries:-</em></strong></p><blockquote><em>socket, imutils, pickle, struct, cv2</em></blockquote><p>Here I am using socket programming for live streaming.</p><p>Socket programming is a way of connecting two nodes on a network to communicate with each other. One socket(node) listens on a particular port at an IP, while other socket reaches out to the other to form a connection. Server forms the listener socket while client reaches out to the server.</p><p><strong><em>So let’s make a Live video chat app:-</em></strong></p><p>We need to create a two python file, one serves as a client and other works as server.</p><p><em>First file named as </em><strong><em>server.py. </em></strong><em>Below is the code of this file.</em></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/69f8ed8b8dd66bd4cf07f2753c22ac66/href">https://medium.com/media/69f8ed8b8dd66bd4cf07f2753c22ac66/href</a></iframe><p><em>Now second file named as </em><strong><em>client.py</em></strong><em>. Below is the code of this file.</em></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a8deff9bf0d1f2fc97880a816dbd18a0/href">https://medium.com/media/a8deff9bf0d1f2fc97880a816dbd18a0/href</a></iframe><p><em>Run </em><strong><em>server.py</em></strong><em> file and you get your </em><strong><em>host ip </em></strong><em>of your system. Enter your host ip in </em><strong><em>client.py</em></strong><em> file in socket creation section.</em></p><p><em>Now run</em><strong><em> client.py</em></strong><em> file and see your webcam light opens and two video frame open one is from server side and another is client side.</em></p><p><strong><em>Here is the output-:</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0Jnfxq3sj0T9lKimJSRE5A.png" /></figure><p><em>Our Live Stream Video chat app run successfully….</em> 😊</p><p>Thanks for Reading ❤</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=64a022523cbc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Confusion Matrix and it’s implementation in Cyber Crime Cases]]></title>
            <link>https://krishnapal3sep.medium.com/confusion-matrix-and-its-implementation-in-cyber-crime-cases-751ca54e239b?source=rss-170805c84ad1------2</link>
            <guid isPermaLink="false">https://medium.com/p/751ca54e239b</guid>
            <category><![CDATA[cybercrime]]></category>
            <category><![CDATA[data]]></category>
            <category><![CDATA[cyberattack]]></category>
            <category><![CDATA[confusion-matrix]]></category>
            <category><![CDATA[monitoring]]></category>
            <dc:creator><![CDATA[Krishna Pal]]></dc:creator>
            <pubDate>Sun, 06 Jun 2021 03:54:30 GMT</pubDate>
            <atom:updated>2021-06-06T03:54:30.990Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nHCSmz8hJ3Iai6MkDWrmuQ.jpeg" /></figure><p><strong><em>Cyber ​​attacks have become one of the biggest problems in the world. They wreak havoc on countries and individuals on a daily basis. Increasing cyber attacks also lead to cyber crime. Key elements in the fight against crime and criminals are to identify cyber criminals and to understand the methods of attack. Finding and avoiding cyber attacks is a daunting task. However, researchers have recently been able to solve these problems by building security models and making predictions on artificial intelligence.</em></strong></p><p><strong><em>There is one of the metrics used to classify these cyber crime events named as Confusion Matrix. So before knowing correlation between Confusion Matrix and Cyber Crime, let’s deep dive to know about Confusion Matrix.</em></strong></p><p><strong><em>What is Confusion Matrix?</em></strong></p><p><em>The confusion matrix is a summary of the predictive effects on the separation problem. The number of positive and negative predictions is summarized by the calculation values ​​and divided by each category. This is the key to the confusion matrix.</em></p><p><em>A Confusion matrix is matrix of 2 X 2 which consist of True positive, True Negative, False Positive and False Negative.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/649/1*wzaQmU07bIMh801-yIk3SA.png" /></figure><p><strong>📌True Positive-: </strong>True positive (TP) refers to the actual value and the predicted value is 1 means True.</p><blockquote><strong>For example-</strong> You predicted that a man is deaf and he actually is.</blockquote><p><strong>📌True Negative-:</strong> True negative (TN) refers to the actual value and the predicted value is 0 means False.</p><blockquote><strong>For example-</strong> You predicted that a man is not deaf and he actually is not.</blockquote><p><strong>📌False Positive-:</strong> False positive (FP) refers that the actual value is 0 but the predicted value is 1. False Positive is a <strong>Type 1 error</strong>. It is most dangerous error.</p><blockquote><strong>For example-</strong> You predicted that a man is deaf but he actually is not.</blockquote><p><strong>📌False Negative-:</strong> False Negative (FN) refers that the actual value is 1 but the predicted value is 0. False negative is a <strong>Type 2 error.</strong></p><blockquote><strong>For example-</strong> You predicted that a man is not deaf but he actually is.</blockquote><p><strong><em>What is Accuracy?</em></strong></p><p><em>Accuracy represents the number of correctly classified data instances over the total number of data instances.</em></p><p><strong>Formula to Calculate Accuracy-:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/869/1*vEIOnOzzLoqD78yblvSPtg.png" /></figure><p><strong><em>What is Precision?</em></strong></p><p><em>It is the average of the best predicted samples in the total number of positively predicted samples.</em></p><p><strong>Formula to Calculate Precision-:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/561/1*dD_jDemX_esQ27RxE3wy3g.png" /></figure><p><strong><em>What is Recall?</em></strong></p><p><em>Recall literally is how many of the true positives were recalled (found), i.e. how many of the correct hits were also found. Recall is also known as </em><strong><em>sensitivity </em></strong><em>or </em><strong><em>true positive rate.</em></strong></p><p><strong>Formula to Calculate Recall-:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*iFkaQc_Da4Unh-zYV1JgEQ.png" /></figure><p><strong><em>What is F1 Score?</em></strong></p><p><em>F1 score helps to measure Recall and Precision at the same time. It is a Harmonic Mean of </em><strong><em>precision</em></strong><em> and </em><strong><em>recall</em></strong><em> and is a better measure than </em><strong><em>accuracy</em></strong><em>.</em></p><p><strong>Formula to Calculate F1 Score-:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/858/1*h-iY3Ie59hEK_L3aSAlNVw.png" /></figure><h3><em>Cyber Crime and Confusion Matrix</em></h3><p><em>Let’s suppose a scenario in an Organization Theft of financial or card payment data cyber attack is going to happen. The Organization members proposed a model regarding this event to monitor this cyber attack.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GOUBIwj8eKBLMKSn36lRaQ.png" /><figcaption>Confusion Matrix of Proposed model</figcaption></figure><p><em>The confusion matrix of proposed model where the training size was 0.8 and the test size was 0.2. With this, we know how many cases have been properly divided and how many have been judged incorrectly. It means that we can find the true and wrong benefits of illegal and false models separated by the model. When the test size was 0.40 it predicts three cases of copyright theft. Now, As soon as the test size is increased to 0.60, It predicts that seven identity theft cases have been labeled as infringement and one copyright infringement has been incorrectly terminated as data theft and one identity theft case filed as hacking. The total number of cases divided incorrectly when the test size was increased to 0.8. It shows that fourteen cases of identity theft were poorly classified as copyright infringement and two copyright infringement were improperly filed as identity theft and hacking infringement were improperly identified as theft. Number of unspecified events where test size is 0.5. It shows that the five patent attacks were poorly classified as identity theft attacks and single identity theft attacks were unfairly classified as patents.</em></p><p>Thanks For Reading…😊</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=751ca54e239b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Launching a GUI Application in Docker Container]]></title>
            <link>https://krishnapal3sep.medium.com/launching-a-gui-application-in-docker-container-22b90940c75e?source=rss-170805c84ad1------2</link>
            <guid isPermaLink="false">https://medium.com/p/22b90940c75e</guid>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[firefox]]></category>
            <category><![CDATA[containers]]></category>
            <category><![CDATA[jupyter-notebook]]></category>
            <category><![CDATA[gui]]></category>
            <dc:creator><![CDATA[Krishna Pal]]></dc:creator>
            <pubDate>Mon, 31 May 2021 06:15:18 GMT</pubDate>
            <atom:updated>2021-05-31T06:15:18.313Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*c8y-BQ2SJWZSvOC48Ov7Gw.png" /></figure><h3><strong><em>Task Description 📄</em></strong></h3><p><strong><em>📌 GUI container on the Docker</em></strong></p><p><strong><em>🔅 Launch a container on docker in GUI mode</em></strong></p><p><strong><em>🔅 Run any GUI software on the container</em></strong></p><h3><strong>Pre-requisite</strong></h3><p><em>✔ Docker should be installed in a System.</em></p><p><strong>To check whether Docker is installed in your system or not, run the following to command to check it out.</strong></p><pre><strong><em>command-: docker info</em></strong></pre><blockquote>Now to start docker service type <strong>systemctl start docker</strong> command. After typing this command check the status of running docker service using command <strong>systemctl status docker</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/734/1*H3GFWfNbRC0SLE7keAHing.png" /></figure><p>So our docker service is running. It’s time to pull image from <a href="http://hub.docker.com/"><strong>DockerHub</strong></a> to our base OS <strong>Red Hat Enterprise Linux 8</strong></p><pre><strong><em>Command to pull image from DockerHub-: docker pull &lt;image_name&gt;:&lt;version_name&gt;</em></strong></pre><p>Here, I am using<strong> CentOS</strong> latest image. To see downloaded images in docker</p><pre><strong><em>Command-: docker images</em></strong></pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/585/1*2xokxKyjCg1g31LvK_JzzA.png" /></figure><p>Now it’s time to launch container on docker in <strong>GUI Mode.</strong></p><pre><strong><em>Command-: docker run -it --net=host --env=&quot;DISPLAY&quot; --name GuiOS -p 1234:8888 centos:latest</em></strong></pre><blockquote>👉 - -net = for using host’s network.</blockquote><blockquote>👉 -env = for using environment variable (DISPLAY).</blockquote><blockquote>👉 -p = for binding 8888 port no with port no.1234 of Dockerhost.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/740/1*OyAY8HG_boTFS-FTXFndLg.png" /></figure><p>Now install any GUI Application inside container. Here I am installing Jupyter and Firefox.</p><pre><strong><em>command to install jupyter-: pip3 install jupyter<br>command to install firefox-: yum install firefox</em></strong></pre><blockquote><strong>Note-: For installing jupyter, you firstly have python3 installed in container. For installing python3 -:</strong></blockquote><pre><strong><em>Command-: yum install python3-pip</em></strong></pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/737/1*j_6HU9c_Q9MUB5OVpWOizA.png" /><figcaption>Jupyter installation</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/732/1*TkMXOupOgLHHlElZhXPj1Q.png" /><figcaption>Firefox installation</figcaption></figure><p>After installation of these applications it’s time to launch a GUI application.</p><p>Here, I am launching <strong>jupyter</strong> application with root user access.</p><blockquote><strong><em>Note-: </em>Firefox must be installed in order to run jupyter.</strong></blockquote><pre><strong><em>Command-: jupyter notebook --allow-root</em></strong></pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/739/1*M2NT-2jXFODgRQ7BtOXMrg.png" /></figure><p>Hurray!… We successfully run GUI Application inside docker container.😍</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XeZLNyFNbpBtqU2ZPJyetQ.png" /><figcaption>Jupyter notebook running</figcaption></figure><p>Thanks for reading… 😃</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=22b90940c75e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Train and Run ML Model inside a Docker Container]]></title>
            <link>https://krishnapal3sep.medium.com/train-and-run-ml-model-inside-a-docker-container-9fd89ac4c8a?source=rss-170805c84ad1------2</link>
            <guid isPermaLink="false">https://medium.com/p/9fd89ac4c8a</guid>
            <category><![CDATA[python3]]></category>
            <category><![CDATA[containerization]]></category>
            <category><![CDATA[centos-8]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Krishna Pal]]></dc:creator>
            <pubDate>Thu, 27 May 2021 11:19:09 GMT</pubDate>
            <atom:updated>2021-05-27T11:19:09.419Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/815/1*VhPe_HyLUeDgZhsJNCRATA.png" /></figure><p><strong><em>Steps to be followed to achieve this task</em></strong>👨‍💻</p><p>👉 <strong><em>Pull the Docker container image of CentOS image from DockerHub and create a new container</em></strong></p><p>👉<strong> <em>Install the Python software on the top of docker container</em></strong></p><p>👉 <strong><em>In Container you need to copy/create machine learning model which you have created in Jupyter notebook</em></strong></p><h4><strong>Pre-requisite</strong></h4><p><em>✔Any OS having Docker Installed.</em></p><p>✔Having a dataset.</p><p><strong>To check whether Docker is installed in your system or not, run the following to command to check it out.</strong></p><blockquote>Command-: <strong>docker info</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/642/1*UmYW2QecBgCGCA6VYUFjdg.png" /></figure><blockquote>Now to start docker service type <strong>systemctl start docker</strong> command. After typing this command check the status of running docker service using command <strong>systemctl status docker</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/641/1*le1FH2DOoA5nk3tyDR2PUQ.png" /></figure><p>Now docker service started. It’s time to pull CentOS image from <a href="http://hub.docker.com/">DockerHub </a>to our Red Hat Enterprise Linux 8 System.</p><blockquote>Command to pull any image-:<strong><em> docker pull &lt;image_name&gt;:&lt;version_name&gt;</em></strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/591/1*-FMr6TGdOE3IwcztT69uEw.png" /></figure><blockquote>To see the images that has been downloaded type <strong><em>docker images </em></strong>command.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/585/1*2xokxKyjCg1g31LvK_JzzA.png" /></figure><p>So, required image has been downloaded. Now we can create container using this image.</p><blockquote>Command to create container-: <strong><em>docker run -it centos : latest</em></strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/581/1*cU5WvTkBmRq5cqAOMlGSQg.png" /></figure><p>Now new container running with a image name centos latest version.</p><p>Now, we need to install <strong>python3 </strong>inside this container.</p><blockquote>Command-: <strong><em>yum install python3-pip</em></strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/595/1*uRp2d5czAcvj3UhcIR98GA.png" /></figure><p>Now after python3 installation, install python libraries so that we can work on a dataset.</p><p>Install <strong>pandas</strong> library so that we can read or load the dataset that is created in excel file having .csv extension.</p><blockquote>Command-: <strong><em>pip3 install pandas</em></strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/730/1*ewZBR6LwEYzwdplYtfLaoQ.png" /></figure><p>Along with it <strong>numpy </strong>library also installed with pandas library.</p><p>Now install <strong>scikit-learn </strong>library which provides many useful functions and algorithms for creating ML models</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/727/1*vqsVegEBexeQPlx5f1wrWA.png" /></figure><p>After installation had been done our base environment is ready to use. Now we want a dataset inside a container to work upon.</p><p>So firstly upload your dataset on Github and download it inside a container using <strong>git clone </strong>command.</p><p>Before running above command make sure that we have git installed in container or not.</p><blockquote>To install git in container here is the command-: <strong><em>yum install git</em></strong></blockquote><p>Here is the github repo link to download the dataset-:</p><p><a href="https://github.com/Krishna3-cloud/salarypredicter-ml-model.git">Krishna3-cloud/salarypredicter-ml-model</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/727/1*oOjtyQJVCmU7a5hl3UgwlA.png" /></figure><p>Now we have our dataset inside a container.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/733/1*b5RKpXyZC4MC7qZhIw7JkQ.png" /></figure><p>So now, we have to create a python script file named <strong>salaryml.py </strong>to train our model and run it on our workspace environment.</p><blockquote>For creating file we use <strong>vi editor -: vi salaryml.py</strong></blockquote><p><strong>Here is the python code of model-:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/797/1*PEDmyu4uDDoR5Xn5cu61SQ.png" /></figure><p>Now run this file to check whether it is working or not. To run this file using command <strong>python3 salaryml.py</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/678/1*15fA-WxebbQQZ5_bGcNakA.png" /><figcaption>salaryml.py</figcaption></figure><p>Bravo.. Here our code has been runned successfully. Now here we need to create another python script file named <strong>salarypredict.py </strong>to predict the salary for some years of experience.</p><blockquote>For creating <strong>salarypredict.py file-: vi salarypredict.py</strong></blockquote><p><strong>Here is the python code-:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/679/1*fBdClQxKCYiK48lczqMXgA.png" /><figcaption>salarypredict.py</figcaption></figure><p>Now, run this file. Firstly it will load the model and predict the salary based on the years of experience.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/680/1*u3LwU5uK57tRO5rqGDWyUw.png" /></figure><p>Hurray!… Code run successfully. 😊</p><p>Now , we have successfully created ML Model and done Prediction inside a Docker Container.</p><p>Thanks for Reading 😍</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9fd89ac4c8a" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>