<?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>DEV Community: Ragu</title>
    <description>The latest articles on DEV Community by Ragu (@ragu_09).</description>
    <link>https://dev.to/ragu_09</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F954043%2Fe9e3f43d-ae4c-431e-8e9a-682604790b22.png</url>
      <title>DEV Community: Ragu</title>
      <link>https://dev.to/ragu_09</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ragu_09"/>
    <language>en</language>
    <item>
      <title>Docker Networking</title>
      <dc:creator>Ragu</dc:creator>
      <pubDate>Sat, 19 Nov 2022 07:43:30 +0000</pubDate>
      <link>https://dev.to/ragu_09/docker-networking-2ddc</link>
      <guid>https://dev.to/ragu_09/docker-networking-2ddc</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;Source from Zeal Vora,KPLABS Course(Premium Instructor at Udemy)&lt;br&gt;
&lt;a href="https://www.udemy.com/course/docker-certified-associate"&gt;Udemy&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Zeal is one of my favorite author for docker. Please try to yourself 💖&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;(Tip: HE is ready to give some discount for students 😜)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Hi buddy, this is all are intermediate points. if you need to basic understanding please look at my previous docker beginner blog otherwise please ignore  &lt;/p&gt;

&lt;h2&gt;
  
  
  -----------------Table of content-----------------
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Networking &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Type of networks in docker &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Publish the argument&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Legacy approach &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Docker networking commands&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;




&lt;ol&gt;
&lt;li&gt;Networking &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Communication between the container or securely make the communication so we using the networking.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--8qHuHOKs--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jt4bfxjqry3fp4i6nocz.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--8qHuHOKs--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jt4bfxjqry3fp4i6nocz.jpg" alt="docker" width="743" height="456"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Container security &lt;/li&gt;
&lt;li&gt;Purpose of public and private containers&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;Type of networks in docker &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Based on microservice application need networking configuration was changed (private and public communication).&lt;/p&gt;

&lt;p&gt;Docker0 interface is a default network card for docker.Inside of all network related activity based on docker0 virtual network card &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;    Bridge network&lt;/li&gt;
&lt;li&gt;    User define bridge network &lt;/li&gt;
&lt;li&gt;    Host network&lt;/li&gt;
&lt;li&gt;    NAT network&lt;/li&gt;
&lt;li&gt;    None network&lt;/li&gt;
&lt;li&gt;    overlay&lt;/li&gt;
&lt;li&gt;    macvlan&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Bridge network
&lt;/h2&gt;

&lt;p&gt;A bridge network uses a software bridge that allows containers connected to the same bridge network to communicate while providing isolation from containers which are not connected to that bridge network&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--gdyCgFSR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pw6ixa68ne7j9j152a66.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--gdyCgFSR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pw6ixa68ne7j9j152a66.JPG" alt="dn" width="553" height="296"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Bridge is default network for docker.Its easy to make the communication between inside and across the host.simply mention the diagram. its a two way communication &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If we do not specify a driver,  this is the type of network you are creating.&lt;/p&gt;

&lt;p&gt;When you start Docker, a default bridge network (also called a bridge) is created automatically, and newly-started containers connect to it unless otherwise specified.&lt;/p&gt;

&lt;p&gt;We also can create a User-Defined Bridge Network which is superior to the default bridge.&lt;/p&gt;

&lt;h2&gt;
  
  
  User define bridge network
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;User-defined bridges provide automatic DNS resolution between containers.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Containers on the default bridge network can only access each other by IP addresses, unless you use the --link option, which is considered legacy&lt;/strong&gt;. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;On a user-defined bridge network, containers can resolve each other by name or alias.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Host network
&lt;/h2&gt;

&lt;p&gt;Connection establish the with-in the host its called host network.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s---gO-9Rr7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d6f2mpevo1bes71o2h5w.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---gO-9Rr7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d6f2mpevo1bes71o2h5w.JPG" alt="dn" width="554" height="273"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  NAT network(Network address translation)
&lt;/h2&gt;

&lt;p&gt;It's kind of bridge network but one way transaction.some time database containers is a private network but update some necessary package via internet so in this case use this NAT.no one can ping the inside of container.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--A5y37hDU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ee5065nqp5lmkcz6al1s.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--A5y37hDU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ee5065nqp5lmkcz6al1s.JPG" alt="nat" width="560" height="272"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  None network
&lt;/h2&gt;

&lt;p&gt;If you want to completely disable the networking stack on a container, you can use the none network.&lt;/p&gt;

&lt;p&gt;This mode will not configure any IP for the container and doesn’t have any access to the external network as well as for other containers.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;3.Publish the argument&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;We were discussing an approach to publishing container port to host.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;docker container run -dt --name webserver -p 80:80 nginx&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This is also referred to as a publish list as it publishes the only a list of the port specified.&lt;/p&gt;

&lt;p&gt;There is also a second approach to publish all the exposed ports of the container.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;docker container run -dt --name webserver -P nginx&lt;br&gt;
&lt;/code&gt;&lt;br&gt;
This is also referred to as a publish all.&lt;/p&gt;

&lt;p&gt;In this approach, all exposed ports are published to random ports of the host.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;4.Legacy approach&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Before the Docker networks feature, you could use the Docker link feature to allow containers to discover each other and securely transfer information about one container to another container.&lt;/p&gt;

&lt;p&gt;The --link flag is a legacy feature of Docker. It may eventually be removed. Unless you absolutely need to continue using it, we recommend that you use user-defined networks to facilitate communication between two containers instead of using --link&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Docker networking commands&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;See the available docker network interface &lt;/p&gt;

&lt;p&gt;&lt;code&gt;docker network ls&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;See the available system network interface&lt;/p&gt;

&lt;p&gt;&lt;code&gt;ifconfig&lt;/code&gt;&lt;/p&gt;

</description>
      <category>devops</category>
      <category>docker</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Docker Intermediate</title>
      <dc:creator>Ragu</dc:creator>
      <pubDate>Tue, 15 Nov 2022 17:52:28 +0000</pubDate>
      <link>https://dev.to/ragu_09/docker-intermediate-1463</link>
      <guid>https://dev.to/ragu_09/docker-intermediate-1463</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;Source from Zeal Vora,KPLABS Course(Premium Instructor at Udemy)&lt;br&gt;
&lt;a href="https://www.udemy.com/course/docker-certified-associate"&gt;Udemy&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Zeal is one of my favorite author for docker. Please try to yourself 💖&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;(Tip: HE is ready to give some discount for students 😜)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Hi buddy, this is all are intermediate points. if you need to basic understanding please look at my previous docker beginner blog otherwise please ignore  &lt;/p&gt;

&lt;h2&gt;
  
  
  -----------------Table of content-----------------
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Docker file&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;COPY VS ADD &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;EXPOSE&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;HEALTH CHECK &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;ENTRY POINT&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;WORKDIR&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;ENV&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;TAG&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Docker commit&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;layer of docker images&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Inspect &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Prune&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Flattening image &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Docker registry&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Apply the filters&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;16.Moving the image across the host&lt;/p&gt;

&lt;p&gt;17.Build cache&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;1.Docker file&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Every docker container based on images. Images based on docker files.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--J65sKMwI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vo4b78z6r4nibzjaf158.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--J65sKMwI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vo4b78z6r4nibzjaf158.png" alt="docker" width="361" height="140"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Docker files contain the set of commands and microservice procedures. Docker file start FROM instructions its is a base image&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;FROM busybox
ENV NGINX 1.2
RUN touch web-$NGINX.txt
CMD ["/bin/sh"]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;** 2. COPY VS ADD **&lt;/p&gt;

&lt;p&gt;Both command are copy the file from local to inside the container but depends on need it will change.&lt;/p&gt;

&lt;p&gt;COPY = copy the files from local to inside the container&lt;br&gt;
ADD = get the files from website like application zip files then &lt;br&gt;
      unzip the exact destination&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;COPY src dest
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;** 3. EXPOSE **&lt;/p&gt;

&lt;p&gt;Expose command used for port documentation. Its helps to where we are going to run the port.so clear about the port mapping &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--fppFxRQj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/e4cf8omx143anhvp63cx.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--fppFxRQj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/e4cf8omx143anhvp63cx.JPG" alt="docker" width="590" height="313"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;EXPOSE port-no
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;4. HEALTH CHECK&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;Health check is testing our application healthy or not. Its check some argument and true or false condition.&lt;br&gt;
Condition is true application is healthy whether condition is false application is un-healthy&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--l9dRxlDT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lacgyvquw0r9615vz8cn.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--l9dRxlDT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lacgyvquw0r9615vz8cn.JPG" alt="docker" width="361" height="302"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;HEALTHCHECK --interval=35s --timeout=4s CMD curl -f https://localhost/ || exit 1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;5. ENTRY POINT&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In Docker files, an ENTRYPOINT instruction is used to set executables that will always run when the container is initiated. Unlike CMD commands, ENTRYPOINT commands cannot be ignored or overridden—even when the container runs with command line arguments stated&lt;/p&gt;

&lt;p&gt;Once container is start we will give the dynamic command options in entry point section&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ENV name Darwin
ENTRYPOINT ["/bin/echo", "Welcome, $name"] 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;6. WORKDIR&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Containers default working directory is called WORKDIR. once execute the container we launch directly in which one we mention the WORKDIR argument.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;WORKDIR destination
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;7. ENV&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;ENV is a similar like system environment variable. Its works like key and value pair options inside of the container. We pass the dynamic value instead of ENV.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ENV command
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;8. TAG&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Tag the image for reference. Help to improve the image information and maintenance&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;tag image-id tag-name
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;9. Docker commit&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;clone the running docker container for version maintenance and reusability.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker commit container-id
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;10. layer of docker images&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;Docker is the layer architecture so each docker file line represent the layer.Layer have a unique information &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--PtbfgHHt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o66p12dxp336ju9wizu4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--PtbfgHHt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o66p12dxp336ju9wizu4.png" alt="docker" width="880" height="632"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;*&lt;em&gt;11. Inspect *&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Docker image have a lot of information include date,command,size and os architect see the all info associate with the docker image.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker inspect
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;12. Prune&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Clean-up the dangling and unused images with prune.It's helps to reduce the unused images and increase the system memory.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker prune
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;12. Flattening image&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;Use to create the single layer image.Its helps to manage the storage.single layer of image and fulfill the all requirement&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;FROM debian:wheezy WORKDIR /tmp RUN wget -nv http://centurylinklabs.com/someutility-v1.0.0.tar.gz &amp;amp;&amp;amp; \ tar -xvf someutility-v1.0.0.tar.gz &amp;amp;&amp;amp; \ mv /tmp/someutility-v1.0.0/someutil /usr/bin/someutil &amp;amp;&amp;amp; \ rm -rf /tmp/someutility-v1.0.0 &amp;amp;&amp;amp; \ rm /tmp/someutility-v1.0.0.tar.gz

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;13. Docker registry&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--m3fVa4dQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7lqp0j9k3sltuvk8e34m.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--m3fVa4dQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7lqp0j9k3sltuvk8e34m.JPG" alt="docker" width="602" height="302"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Its help to maintain the image version in repository.similar to github method.we have two option private and public repository. push pull and tag in options are available with repository.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;15. Apply the filters&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;Public repository have a so many options in images.official and unofficial image options are available so filiter help to getting the exact image option.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker search image name
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;--filter , -f       Filter output based on conditions provided
--format        Pretty-print search using a Go template
--limit number          Max number of search results
--no-trunc      Don't truncate output
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;16.Moving the image across the host&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;It helps to move the image one environment to another one.&lt;br&gt;
first archive and load the file then move the tar file.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker save myapp &amp;gt; myapp.tar
docker load &amp;lt; myapp.tar
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;17.Build cache&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Already we discuss docker is the layer architecture so each and every layer have a individual build structure .&lt;/p&gt;

&lt;p&gt;Rebuild the same images multiple times that time docker refer to the cache. its save the build time.rather than we add the new step for same docker image that time only docker build again.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--senaG7gC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d2274h4a94ne78et8dzx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--senaG7gC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d2274h4a94ne78et8dzx.png" alt="docker" width="679" height="327"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>devops</category>
      <category>webdev</category>
      <category>beginners</category>
      <category>programming</category>
    </item>
    <item>
      <title>Docker for Beginner's</title>
      <dc:creator>Ragu</dc:creator>
      <pubDate>Mon, 07 Nov 2022 19:32:19 +0000</pubDate>
      <link>https://dev.to/ragu_09/docker-for-beginners-44m1</link>
      <guid>https://dev.to/ragu_09/docker-for-beginners-44m1</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;Source from Zeal Vora,KPLABS Course(Premium Instructor at Udemy)&lt;br&gt;
&lt;a href="https://www.udemy.com/course/docker-certified-associate"&gt;Udemy&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Zeal is one of my favorite author for docker. Please try to yourself 💖&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;(Tip: HE is ready to give some discount for students 😜)&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  -----------------Table of content-----------------
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;What is docker and why we need ?&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Docker Installation and pre-requisite &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Image VS. Containers&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Basic commands &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;port binding&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Attached and detached mode&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Restart policy&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Disk usage &lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;




&lt;p&gt;&lt;strong&gt;1.Container and purpose&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;Docker is the set of alone process and container tool. Its easy to deploy the microservice with running application using the containers.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Weightless &lt;/li&gt;
&lt;li&gt;Movable&lt;/li&gt;
&lt;li&gt;Compact &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;2. Docker Installation and pre-requisite&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Docker available in variety of operating systems, this includes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Windows &lt;/li&gt;
&lt;li&gt;Linux &lt;/li&gt;
&lt;li&gt;MAC&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The installation of Docker is pretty straight forward in each one of them.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://docs.docker.com/get-docker/"&gt;Docker installation&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Image VS. Containers&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Microservice application (Recipe of microservice) procedural code is called image&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--NaVzjtVw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xb16d3am31umt6cf4z0f.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--NaVzjtVw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xb16d3am31umt6cf4z0f.png" alt="container" width="880" height="359"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Running docker image is called container.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--6suV9XuR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/322834ed3somtw0uoha0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--6suV9XuR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/322834ed3somtw0uoha0.png" alt="container" width="251" height="201"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Basic commands&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;docker images&lt;/code&gt; -  List the docker images&lt;/p&gt;

&lt;p&gt;&lt;code&gt;docker pull image-name&lt;/code&gt; i Pull the image from docker hub&lt;br&gt;
&lt;code&gt;docker ps&lt;/code&gt; - List the container&lt;br&gt;
&lt;code&gt;docker stop container-ID&lt;/code&gt; - Stop the container&lt;br&gt;
&lt;code&gt;docker start container-ID&lt;/code&gt; - Start the container&lt;br&gt;
&lt;code&gt;docker rm -f image name&lt;/code&gt; - Remove the docker image&lt;br&gt;
&lt;code&gt;netstat -ntlp&lt;/code&gt; - See the running port&lt;br&gt;
&lt;code&gt;docker exec -it container-id /bin/bash&lt;/code&gt; - Goto inside the container&lt;br&gt;
&lt;code&gt;docker run -dt -p containerport:actualport --name=anyname conatainer id - Port mapping with container&lt;br&gt;
&lt;/code&gt;&lt;br&gt;
&lt;code&gt;docker container stop $(docker container ls -aq)&lt;/code&gt; - Stop the all container&lt;/p&gt;

&lt;p&gt;&lt;code&gt;docker container rm $(docker container ls -aq)&lt;/code&gt; - Remove the all container&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. port binding&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Goto inside the container&lt;/p&gt;

&lt;p&gt;&lt;code&gt;docker exec -it container-id /bin/bash&lt;/code&gt; &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Port mapping with container&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--oQVyCR6u--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bce8lhb3cpglqnuljuml.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--oQVyCR6u--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bce8lhb3cpglqnuljuml.png" alt="Image description" width="421" height="211"&gt;&lt;/a&gt;&lt;br&gt;
&lt;code&gt;docker run -dt -p 80:81 --name=anyname conatainer id&lt;/code&gt; &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;6. Attached and detached mode&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;docker run -dt&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;d - detached mode&lt;br&gt;
t - terminal tty&lt;/p&gt;

&lt;p&gt;When we start a docker container, we need to decide if we want to run in a default foreground mode or the detached mode.&lt;/p&gt;

&lt;p&gt;You may want to use this if you want a container to run but do not want to view and follow all its output&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;7. Restart policy&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;when docker daemon is stopped that time entire container goes &lt;br&gt;
 down. we avoid that situation so we using the restart policy&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;no - Do not automatically restart the container&lt;/li&gt;
&lt;li&gt;on-failure - Restart the container if its exists due to an error&lt;/li&gt;
&lt;li&gt;unless-stopped - Restart the container unless it is explicitly stopped &lt;/li&gt;
&lt;li&gt;always - Always restart the container if it stops&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;8. Disk usage&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;docker system df&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--18Fd8hy7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xygzdozsukqzf0kuu3jr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--18Fd8hy7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xygzdozsukqzf0kuu3jr.png" alt="container" width="880" height="243"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>devops</category>
      <category>tutorial</category>
      <category>docker</category>
    </item>
  </channel>
</rss>
