<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Debug School: Nilesh Kumar</title>
    <description>The latest articles on Debug School by Nilesh Kumar (@nilesh35apiit_74).</description>
    <link>https://www.debug.school/nilesh35apiit_74</link>
    <image>
      <url>https://www.debug.school/images/nMMimywNnscioKCXiVE9S58o3LLElzy5sFlRNmZksxo/rs:fill:90:90/g:sm/mb:500000/ar:1/aHR0cHM6Ly93d3cu/ZGVidWcuc2Nob29s/L3VwbG9hZHMvdXNl/ci9wcm9maWxlX2lt/YWdlLzIxMy8xYTcz/ZTkxNC03MzhhLTQ1/MGMtYjMyMC1iOWE4/NWNiZDliMzYucG5n</url>
      <title>Debug School: Nilesh Kumar</title>
      <link>https://www.debug.school/nilesh35apiit_74</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://www.debug.school/feed/nilesh35apiit_74"/>
    <language>en</language>
    <item>
      <title>Steps to create docker image</title>
      <dc:creator>Nilesh Kumar</dc:creator>
      <pubDate>Tue, 15 Nov 2022 07:27:00 +0000</pubDate>
      <link>https://www.debug.school/nilesh35apiit_74/steps-to-create-docker-image-2lb0</link>
      <guid>https://www.debug.school/nilesh35apiit_74/steps-to-create-docker-image-2lb0</guid>
      <description>&lt;p&gt;Here we are trying to create an image out of base ubuntu image.&lt;/p&gt;

&lt;p&gt;======================================================================&lt;/p&gt;

&lt;h2&gt;
  
  
  How to create an image?
&lt;/h2&gt;

&lt;p&gt;Method - 1 - using containers - 1 Layer a time == docker commit&lt;/p&gt;

&lt;p&gt;Method - 2 - using Dockerfile - N Layer a time == docker build&lt;/p&gt;




&lt;p&gt;Method - 1 - using containers - 1 Layer a time == docker commit&lt;/p&gt;

&lt;p&gt;IMAGE= ubuntu + git + apache2 + java&lt;/p&gt;

&lt;p&gt;237  docker run -itd --name raj1 ubuntu&lt;br&gt;
  238  docker ps&lt;br&gt;
  239  docker exec -it raj1 /bin/bash&lt;/p&gt;




&lt;p&gt;INSIDE Container&lt;/p&gt;

&lt;p&gt;apt-get update&lt;br&gt;
apt-get install git&lt;br&gt;
apt-get install apache2&lt;br&gt;
apt-get install openjdk-11-jdk -y&lt;/p&gt;




&lt;p&gt;240  docker ps&lt;br&gt;
  241  clear&lt;br&gt;
  242  docker history ubuntu&lt;br&gt;
  243  docker ps&lt;br&gt;
  244  docker commit -m"up-ub-git-ap-java" -a"Rajesh Kumar"  up-ub-git-ap-java&lt;br&gt;
  245  docker history ubuntu&lt;br&gt;
  246  docker history up-ub-git-ap-java&lt;br&gt;
  247  docker images&lt;br&gt;
  248  docker run -itd --name newcont up-ub-git-ap-java&lt;br&gt;
  249  docker ps&lt;br&gt;
  250  dcoker exec  git&lt;br&gt;
  251  docker exec  git&lt;br&gt;
  252  docker exec  java&lt;br&gt;
  253  docker exec  which apache2&lt;/p&gt;

</description>
    </item>
    <item>
      <title>What is a Docker image.</title>
      <dc:creator>Nilesh Kumar</dc:creator>
      <pubDate>Tue, 15 Nov 2022 06:48:16 +0000</pubDate>
      <link>https://www.debug.school/nilesh35apiit_74/what-is-a-docker-image-3ca4</link>
      <guid>https://www.debug.school/nilesh35apiit_74/what-is-a-docker-image-3ca4</guid>
      <description>&lt;p&gt;A docker image consists of layers of filesystem. Base and most bulkiest in size is usually the root file system. &lt;br&gt;
Lets understand with the image httpd.&lt;br&gt;
docker pull httpd and then do &lt;br&gt;
docker inspect httpd&lt;br&gt;
Run following max debt command &lt;br&gt;
du -h --max-dept=1&lt;br&gt;
This command will give you the list of layers that is present for this docker image, it will look something like below &lt;br&gt;
`&lt;/p&gt;

&lt;p&gt;0       ./l&lt;br&gt;
87M     ./cbc6425cda491b250b098dc0c74af0235bea8e6ce4b67cb3bbc115ea821b6eb6&lt;br&gt;
8.0K    ./29566a9c43b68426cb16d9a20876debb439290dc2d685095518ccf2050ba66f5&lt;br&gt;
5.2M    ./75f57747a9aafda7b1b02c02656e60f295d3f9217cf2798c69fc86b9712ed893&lt;br&gt;
59M     ./d97fef69b83d86abd40b6e61f84e1b94324cc72370d2e1ed2e5aa65f0196bc83&lt;br&gt;
12K     ./6294788f871fe9be307c7cfb77544879ec3c422b2db88bfae3cf9265cceceef0&lt;br&gt;
151M    .&lt;br&gt;
` &lt;br&gt;
All these layers when merged together forms a httpd image. &lt;strong&gt;Merging&lt;/strong&gt; happens when we create a container out of this image.&lt;br&gt;
When we starts the container all these layers are merged, if there is conflict in any file then top layer will take precedence. The merged image will have two important directory, diff and merge.&lt;br&gt;
Diff will hold all the changes that we are doing in image, for e.g. lets say you want to create a file in this docer image in /opt/example.txt. This example.txt will go into diff folder of container merged image. and using this it will go and create an container.&lt;/p&gt;

</description>
      <category>dockerimage</category>
    </item>
    <item>
      <title>What is Docker Update</title>
      <dc:creator>Nilesh Kumar</dc:creator>
      <pubDate>Tue, 15 Nov 2022 05:16:59 +0000</pubDate>
      <link>https://www.debug.school/nilesh35apiit_74/what-is-docker-update-53h4</link>
      <guid>https://www.debug.school/nilesh35apiit_74/what-is-docker-update-53h4</guid>
      <description>&lt;p&gt;The docker update command dynamically updates &lt;strong&gt;container&lt;/strong&gt; &lt;strong&gt;configuration&lt;/strong&gt;. You can use this command to prevent containers from consuming too many resources such as CPU and memory from their Docker host. With a single command, you can place limits on a single container or on many.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Notes&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;With the exception of the –kernel-memory option, you can specify these options on a running or a stopped container. On kernel version older than 4.6, you can only update –kernel-memory on a stopped container or on a running container with kernel memory initialized.&lt;/p&gt;

&lt;p&gt;The docker update command dynamically updates container configuration. You can use this command to prevent containers from consuming too many resources such as CPU and memory from their Docker host. With a single command, you can place limits on a single container or on many.&lt;/p&gt;

&lt;p&gt;*&lt;em&gt;Some Examples&lt;br&gt;
*&lt;/em&gt;&lt;br&gt;
Update a container’s cpu-shares&lt;br&gt;
$ docker update --cpu-shares 512 abebf7571666&lt;/p&gt;

&lt;p&gt;Update a container with cpu-shares and memory&lt;br&gt;
$ docker update --cpu-shares 512 -m 300M abebf7571666 hopeful_morse&lt;/p&gt;

&lt;p&gt;Update a new container’s kernel memory constraints&lt;br&gt;
$ $ docker run -dit --name test --kernel-memory 50M ubuntu bash&lt;/p&gt;

&lt;p&gt;Update kernel memory while the container is running:&lt;br&gt;
$ docker update --kernel-memory 80M test&lt;/p&gt;

&lt;p&gt;Started a container without kernel memory initialized:&lt;br&gt;
docker run -dit --name test2 --memory 300M ubuntu bash&lt;/p&gt;

&lt;p&gt;To update restart policy for one or more containers:&lt;br&gt;
$ docker update --restart=on-failure:3 abebf7571666 hopeful_morse&lt;/p&gt;

&lt;p&gt;Add a restart policy to a container that was already created&lt;br&gt;
$ docker update --restart=always &lt;/p&gt;

&lt;p&gt;Update the "RunningContainerNameOrId" to use 1g of memory and only use cpu core 1&lt;br&gt;
$ docker update --memory "1g" --cpuset-cpu "1" &lt;/p&gt;

&lt;p&gt;To up date all running containers to use core 1 and 1g of memory:&lt;br&gt;
$ docker update --cpuset-cpus "1" --memory "1g" $(docker ps | awk 'NR&amp;gt;1 {print $1}')&lt;/p&gt;

&lt;p&gt;Disable auto-restart on a container?&lt;br&gt;
$ docker update --restart=no my-container&lt;/p&gt;

</description>
      <category>dockerupdate</category>
    </item>
    <item>
      <title>Docker Wait</title>
      <dc:creator>Nilesh Kumar</dc:creator>
      <pubDate>Tue, 15 Nov 2022 05:12:39 +0000</pubDate>
      <link>https://www.debug.school/nilesh35apiit_74/docker-wait-62c</link>
      <guid>https://www.debug.school/nilesh35apiit_74/docker-wait-62c</guid>
      <description>&lt;p&gt;When we run docker wait command from the command line with multiple containers( docker wait containerid1 containerid2 ), it holds or blocks the terminal and continuously checks for the container status and outputs the status code once the container stops. However, if we have specified multiple containers, then it checks one by one, which means it will only check the status of the first container then only go to the next one, even if the second container stops before the first container.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example of Docker wait&lt;/strong&gt;&lt;br&gt;
Let’s understand the working of the ‘docker wait’ command with the below examples: –&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Scenario&lt;/strong&gt;: – Simple test the command on the terminal.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Create a few containers as below&lt;/strong&gt;:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;docker run -d --name con2 nginx&lt;br&gt;
docker run -d --name con3 redis&lt;br&gt;
docker run -d --name con1 ubuntu sleep 60&lt;br&gt;
docker ps&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Now, run the ‘docker wait’ command to understand how it works. Run the below command:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;docker wait con3 con1 con2&lt;/p&gt;

&lt;p&gt;Explanation: – In the above example, We have put the con3 in the first place because this container is going to stop automatically, and we get the status code and cursor start blinking again –&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;It will be like this until the other two containers stop working. So, open a new terminal and stop the remaining containers.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;docker stop con1&lt;br&gt;
docker stop con2&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Now, if we go back and check the terminal where the ‘docker wait’ command was running, we can see that we get the prompt : –&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;docker wait con3 con1 con2&lt;/p&gt;

</description>
      <category>dockerwait</category>
    </item>
    <item>
      <title>Difference between docker pause and docker unpause</title>
      <dc:creator>Nilesh Kumar</dc:creator>
      <pubDate>Mon, 14 Nov 2022 10:18:48 +0000</pubDate>
      <link>https://www.debug.school/nilesh35apiit_74/difference-between-docker-pause-and-docker-unpause-13bg</link>
      <guid>https://www.debug.school/nilesh35apiit_74/difference-between-docker-pause-and-docker-unpause-13bg</guid>
      <description>&lt;p&gt;If we want to pause the processes running inside the container, we can use the “docker pause” command.&lt;/p&gt;

&lt;p&gt;$ docker pause &lt;/p&gt;

&lt;p&gt;To un-pause the container, use “docker un-pause” command.&lt;br&gt;
$ docker unpause &lt;/p&gt;

</description>
    </item>
    <item>
      <title>Difference between docker stop and docker kill?</title>
      <dc:creator>Nilesh Kumar</dc:creator>
      <pubDate>Mon, 14 Nov 2022 09:53:35 +0000</pubDate>
      <link>https://www.debug.school/nilesh35apiit_74/difference-between-docker-stop-and-docker-kill-38ep</link>
      <guid>https://www.debug.school/nilesh35apiit_74/difference-between-docker-stop-and-docker-kill-38ep</guid>
      <description>&lt;p&gt;Docker stop terminates the process gracefully, while docker kill will terminate the process abruptly. The docker stop commands issue the SIGTERM signal, whereas the docker kill commands sends the SIGKILL signal.&lt;br&gt;
The docker stop command stops the container gracefully and provides a safe way out. If a docker stop command fails to terminate a process within the specified timeout, the Docker issues a kill command implicitly and immediately.&lt;/p&gt;

</description>
      <category>dockerstop</category>
      <category>dockerkill</category>
    </item>
    <item>
      <title>Docker by Nilesh</title>
      <dc:creator>Nilesh Kumar</dc:creator>
      <pubDate>Mon, 14 Nov 2022 07:24:00 +0000</pubDate>
      <link>https://www.debug.school/nilesh35apiit_74/docker-by-nilesh-312c</link>
      <guid>https://www.debug.school/nilesh35apiit_74/docker-by-nilesh-312c</guid>
      <description>&lt;p&gt;What is Docker?&lt;br&gt;
Docker is name of a company, which provides host of product like (docker engine etc). Using these we can get OS level virtualization to build, deploy, run, update, and stop containers easily. &lt;br&gt;
Why Docker?&lt;br&gt;
Docker provides abstraction and it makes it easier, simpler, and safer to build, deploy and manage multiple containers of different kinds. &lt;br&gt;
What is Container.&lt;br&gt;
Container can be considered as a packages of software, that combines applications and all its dependencies. For e.g :  (bootfs (OS) + java + tomcat + application). These containers are independent and reliable across diffent computing environments. &lt;/p&gt;

&lt;p&gt;Docker workflow&lt;br&gt;
Docker workflow are series of steps to build and publish and image. Docker Deamon running on docker host builds an image based on the configuration of user. This image then gets saved in the Docker registry.  Then Docker daemon either creates a new image or pulls an existing image from the Docker registry. Finally, Daemon creates an instance of a Docker image.  Using this image a containers can be run.&lt;/p&gt;

&lt;p&gt;How container created?&lt;br&gt;
A containers is created using : 1) Ubuntu / Centos os 2) Software required on top of it (Java, PHP, Dotnet etc) 3) Server etc required to run applications like Jboss, Tomcat etc 4) and then we add our applications into it.&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
