<?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"><channel><title><![CDATA[Shadab Gokak's team blog]]></title><description><![CDATA[Shadab Gokak's team blog]]></description><link>https://shadab11.hashnode.dev</link><generator>RSS for Node</generator><lastBuildDate>Sun, 18 Oct 2026 15:31:52 GMT</lastBuildDate><atom:link href="https://shadab11.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[DAY 16 : Docker for DevOps Engineers]]></title><description><![CDATA[Introduction :


Docker is a critical tool for DevOps engineers, streamlining application deployment and collaboration.

It packages apps and dependencies into portable containers, ensuring consistency across environments. Containers offer isolation,...]]></description><link>https://shadab11.hashnode.dev/day-16-docker-for-devops-engineers</link><guid isPermaLink="true">https://shadab11.hashnode.dev/day-16-docker-for-devops-engineers</guid><category><![CDATA[Devops]]></category><category><![CDATA[DevOps Journey]]></category><category><![CDATA[TrainWithShubham]]></category><category><![CDATA[#90daysofdevops]]></category><category><![CDATA[#Devopscommunity]]></category><dc:creator><![CDATA[Shadab Gokak]]></dc:creator><pubDate>Wed, 27 Sep 2023 20:49:58 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1695847690319/45065442-1b38-42dc-a1cb-c68cad0bef47.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="heading-introduction"><strong>Introduction :</strong></h2>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1691229686291/f9131a2b-0f53-4b6f-8c34-fdcd1a8c1cfb.png?auto=compress,format&amp;format=webp" alt /></p>
<ul>
<li><p>Docker is a critical tool for DevOps engineers, streamlining application deployment and collaboration.</p>
</li>
<li><p>It packages apps and dependencies into portable containers, ensuring consistency across environments. Containers offer isolation, boosting security, and ease of scaling.</p>
</li>
<li><p>Docker fits seamlessly into CI/CD pipelines, aiding testing and deployment automation. It supports microservices and IaC, promoting efficient collaboration between teams.</p>
</li>
<li><p>Its resource efficiency allows for more containers on the same hardware, and quick rollbacks simplify issue resolution.</p>
</li>
</ul>
<p>DevOps engineers should grasp Docker commands, Compose, Kubernetes, and container registries, along with security and monitoring practices.</p>
<h2 id="heading-tasks">Tasks :</h2>
<p><strong>Task 1:</strong></p>
<p>Use the docker run command to start a new container and interact with it through the command line. [Hint: docker run hello-world]</p>
<p><strong>COPY</strong></p>
<p><strong>COPY</strong></p>
<pre><code class="lang-plaintext">docker run [OPTIONS] IMAGE [COMMAND] [ARG...]
</code></pre>
<ul>
<li><p><strong>OPTIONS:</strong> Various options to configure the container, such as specifying ports, volumes, environment variables, etc.</p>
</li>
<li><p><strong>IMAGE:</strong> The Docker image you want to run the container from.</p>
</li>
<li><p>COMMAND: (Optional) The command to run inside the container.</p>
</li>
<li><p><strong>ARG...:</strong> (Optional) Arguments passed to the command.</p>
</li>
</ul>
<p><strong>Example 1 :</strong></p>
<p><strong>COPY</strong></p>
<p><strong>COPY</strong></p>
<pre><code class="lang-plaintext">docker run hello-world
</code></pre>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1691159036554/52e7a463-a31b-40d3-804f-073fedeefe4b.png?auto=compress,format&amp;format=webp" alt /></p>
<p><strong>Example 2 :</strong></p>
<p>To run an instance of the official <strong>"nginx"</strong> web server image, you would execute.</p>
<p><strong>COPY</strong></p>
<p><strong>COPY</strong></p>
<pre><code class="lang-plaintext">docker run -d -p 80:80 enginx
</code></pre>
<p>If you want to keep the container running interactively, you can use the <strong>-it</strong> option.</p>
<p><strong>COPY</strong></p>
<p><strong>COPY</strong></p>
<pre><code class="lang-plaintext">docker run -it ubuntu /bin/bash
</code></pre>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1691160106593/e8532d50-6538-4408-a73c-4f4300ae03c3.png?auto=compress,format&amp;format=webp" alt /></p>
<p><strong>COPY</strong></p>
<p><strong>COPY</strong></p>
<pre><code class="lang-plaintext">docker ps -a
</code></pre>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1691227333814/4a4b92bc-0159-4fc4-8172-72cdae2b3644.png?auto=compress,format&amp;format=webp" alt /></p>
<p><strong>Task 2:</strong></p>
<p>Use the <strong>docker inspect</strong> command to view detailed information about a container or image.</p>
<p><strong>COPY</strong></p>
<p><strong>COPY</strong></p>
<pre><code class="lang-plaintext">docker inspect [OPTIONS] NAME|ID [NAME|ID...]
</code></pre>
<ul>
<li><p><strong>OPTIONS:</strong> Additional options to format or filter the output.</p>
</li>
<li><p><strong>NAME|ID:</strong> The name or ID of the Docker object you want to inspect.</p>
</li>
</ul>
<p><strong>Example</strong> :</p>
<p><strong>COPY</strong></p>
<p><strong>COPY</strong></p>
<pre><code class="lang-plaintext">docker inspect hello-world
</code></pre>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1691227458983/c4dd0d1f-57c1-4ced-9e47-0868f9a82409.png?auto=compress,format&amp;format=webp" alt /></p>
<p><strong>Task 3:</strong></p>
<p>Use the <strong>docker port</strong> command to list the port mappings for a container.</p>
<p><strong>COPY</strong></p>
<p><strong>COPY</strong></p>
<pre><code class="lang-plaintext">docker port CONTAINER [PORT/PROTOCOL]
</code></pre>
<ul>
<li><p><strong>CONTAINER</strong>: The name or ID of the container you want to inspect.</p>
</li>
<li><p><strong>PORT/PROTO</strong>: (Optional) The specific port and protocol (TCP or UDP) you want to inspect. If not specified, the command displays all port mappings for the container.</p>
</li>
</ul>
<p><strong>Example</strong> :</p>
<p><strong>Create a container :</strong></p>
<p><strong>COPY</strong></p>
<p><strong>COPY</strong></p>
<pre><code class="lang-plaintext">docker run -d -p 80:80 mynginx

docker port mynginx
</code></pre>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1691227659189/9f174f15-ef97-4a3d-bd02-baf23164d981.png?auto=compress,format&amp;format=webp" alt /></p>
<p><strong>Task 4:</strong></p>
<p>Use the <strong>docker stats</strong> command to view resource usage statistics for one or more containers.</p>
<p><strong>COPY</strong></p>
<p><strong>COPY</strong></p>
<pre><code class="lang-plaintext">docker stats [OPTIONS] [CONTAINER...]
</code></pre>
<ul>
<li><p><strong>OPTIONS:</strong> Additional options that you can use with the docker stats command. Some common options include --no-stream (displays only a single output) and --format (specifies a custom format for the output).</p>
</li>
<li><p><strong>CONTAINER...:</strong> One or more container names or IDs. If no container names or IDs are provided, the command will display statistics for all running containers.</p>
</li>
</ul>
<p>When you run the <strong>docker stats</strong> command, it continuously updates and displays a table with statistics for each specified container.</p>
<p>The table includes columns for the container's name, CPU usage, memory usage, memory limit, network I/O, and block I/O.</p>
<p><strong>Example:</strong></p>
<p><strong>COPY</strong></p>
<p><strong>COPY</strong></p>
<pre><code class="lang-plaintext">docker stats mynginx
</code></pre>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1691227954808/1871c084-5820-4f5c-b157-e07039ee186c.png?auto=compress,format&amp;format=webp" alt /></p>
<p><strong>Task 5:</strong></p>
<p>Use the <strong>docker top</strong> command to view the processes running inside a container.</p>
<p><strong>COPY</strong></p>
<p><strong>COPY</strong></p>
<pre><code class="lang-plaintext">docker top &lt;container_name_or_id&gt; [OPTIONS]
</code></pre>
<ul>
<li><p><strong>&lt;container_name_or_id&gt;:</strong> The name or ID of the container you want to inspect.</p>
</li>
<li><p><strong>OPTIONS:</strong> Additional options that you can use with the docker top command. One common option is --pid which specifies the process ID to display processes for. By default, the command displays processes for all running processes in the container.</p>
</li>
</ul>
<p><strong>Example:</strong></p>
<p><strong>COPY</strong></p>
<p><strong>COPY</strong></p>
<pre><code class="lang-plaintext">docker top mynginx
</code></pre>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1691228082367/d459eb1b-167b-4e28-a605-d53c89feea00.png?auto=compress,format&amp;format=webp" alt /></p>
<p>This command provides a list of the active processes running inside the container along with information about each process, such as its process ID (PID), user, CPU usage, memory usage, and command.</p>
<p><strong>Task 6:</strong></p>
<p>Use the <strong>docker save</strong> command to save an image to a tar archive.</p>
<p><strong>COPY</strong></p>
<p><strong>COPY</strong></p>
<pre><code class="lang-plaintext">docker save [OPTIONS] IMAGE [IMAGE...]
</code></pre>
<ul>
<li><p><strong>OPTIONS:</strong> Additional options that you can use with the docker save command. One common option is -o or --output to specify the output file name.</p>
</li>
<li><p><strong>IMAGE [IMAGE...]:</strong> The name or ID of the Docker image(s) you want to save. You can specify one or more images.</p>
</li>
</ul>
<p><strong>Example</strong>:</p>
<p><strong>COPY</strong></p>
<p><strong>COPY</strong></p>
<pre><code class="lang-plaintext">docker save -o nginx_image.tar nginx
</code></pre>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1691228241480/a96979d5-e747-4933-8bf6-ae88bc2aa1a4.png?auto=compress,format&amp;format=webp" alt /></p>
<p>This command creates a tar archive file called "nginx_image.tar" containing the "nginx" image.</p>
<p><strong>Task 7:</strong></p>
<p>Use the <strong>docker load</strong> command to load an image from a tar archive.</p>
<p><strong>COPY</strong></p>
<p><strong>COPY</strong></p>
<pre><code class="lang-plaintext">docker load [OPTIONS]  my_image.tar
</code></pre>
<p><strong>OPTIONS:</strong> Additional options that you can use with the docker load command.</p>
<p><strong>Example</strong>:</p>
<p><strong>COPY</strong></p>
<p><strong>COPY</strong></p>
<pre><code class="lang-plaintext">docker load -i nginx_image.tar
</code></pre>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1691228393346/6fd008ec-4393-4f6a-816f-fc0fe23eb7d0.png?auto=compress,format&amp;format=webp" alt /></p>
<p>The <strong>docker load</strong> command reads the contents of the specified tar archive file from the standard input and imports the images contained in the archive into your local Docker image repository.</p>
<h2 id="heading-conclusion">Conclusion:</h2>
<p>In conclusion, Docker commands are essential tools for managing and interacting with containers and images within the Docker ecosystem.</p>
<p>These commands empower users to build, deploy, and manage applications efficiently, encapsulating them in isolated environments.</p>
<p>Docker commands enable tasks like creating images from Dockerfiles, running containers, managing networks, and interacting with container logs.</p>
<p>By mastering these commands, developers and administrators can streamline their workflows, enhance collaboration, and ensure the reliable deployment of applications across various environments.</p>
]]></content:encoded></item></channel></rss>