<?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: Kuldeepkumhar-fs</title>
    <description>The latest articles on DEV Community by Kuldeepkumhar-fs (@kuldeepkumharfs).</description>
    <link>https://dev.to/kuldeepkumharfs</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%2F957789%2F80defd62-a0f6-4d61-91b8-eb8c96a64acc.jpeg</url>
      <title>DEV Community: Kuldeepkumhar-fs</title>
      <link>https://dev.to/kuldeepkumharfs</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/kuldeepkumharfs"/>
    <language>en</language>
    <item>
      <title>🛠️ How to Troubleshoot a Kubernetes Cluster: A Step-by-Step Guide 🚀</title>
      <dc:creator>Kuldeepkumhar-fs</dc:creator>
      <pubDate>Mon, 03 Mar 2025 09:47:37 +0000</pubDate>
      <link>https://dev.to/kuldeepkumharfs/how-to-troubleshoot-a-kubernetes-cluster-a-step-by-step-guide-2j30</link>
      <guid>https://dev.to/kuldeepkumharfs/how-to-troubleshoot-a-kubernetes-cluster-a-step-by-step-guide-2j30</guid>
      <description>&lt;p&gt;🛠️ &lt;strong&gt;How to Troubleshoot a Kubernetes Cluster: A Step-by-Step Guide&lt;/strong&gt; 🚀&lt;/p&gt;

&lt;p&gt;Kubernetes is powerful but troubleshooting issues in a K8s cluster can be complex. This guide will help you debug and fix common Kubernetes problems like pod failures, networking issues, node problems, and control plane failures.&lt;/p&gt;

&lt;p&gt;📌 &lt;strong&gt;Keywords:&lt;/strong&gt; Kubernetes troubleshooting, fix Kubernetes issues, Kubernetes debugging, Kubernetes pod errors, Kubernetes service not working, Kubernetes networking issues, Kubernetes health checks failing, Kubernetes CrashLoopBackOff, Kubernetes NotReady node, Kubernetes API server down, kubectl logs, Kubernetes monitoring tools.&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;🛠️ Common Kubernetes Issues &amp;amp; How to Fix Them&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Kubernetes failures usually fall into these categories:&lt;br&gt;
✅ &lt;strong&gt;Pod Issues&lt;/strong&gt; (CrashLoopBackOff, ImagePullBackOff, OOMKilled)&lt;br&gt;
✅ &lt;strong&gt;Service &amp;amp; Networking Issues&lt;/strong&gt; (Pods unreachable, DNS failures)&lt;br&gt;
✅ &lt;strong&gt;Node Issues&lt;/strong&gt; (NotReady nodes, kubelet failures, resource exhaustion)&lt;br&gt;
✅ &lt;strong&gt;Control Plane Issues&lt;/strong&gt; (API Server down, etcd failures)&lt;br&gt;
✅ &lt;strong&gt;Persistent Storage Issues&lt;/strong&gt; (PVC not bound, Disk Pressure)&lt;/p&gt;

&lt;p&gt;Let’s dive into &lt;strong&gt;how to troubleshoot&lt;/strong&gt; each of these step by step! 🔍&lt;/p&gt;


&lt;h2&gt;
  
  
  &lt;strong&gt;🚀 Step 1: Troubleshooting Pod Issues&lt;/strong&gt;
&lt;/h2&gt;
&lt;h3&gt;
  
  
  &lt;strong&gt;🔹 1. Check Pod Status&lt;/strong&gt;
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;kubectl get pods &lt;span class="nt"&gt;-A&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;💡 &lt;strong&gt;Common Issues:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;CrashLoopBackOff&lt;/code&gt; → Pod is repeatedly crashing&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;ImagePullBackOff&lt;/code&gt; → Image pull failed&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;Pending&lt;/code&gt; → Pod is waiting for a resource&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  &lt;strong&gt;🔹 2. Inspect Pod Logs&lt;/strong&gt;
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;kubectl logs &amp;lt;pod-name&amp;gt; &lt;span class="nt"&gt;-n&lt;/span&gt; &amp;lt;namespace&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;💡 &lt;strong&gt;Fix:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If the error is related to the application (e.g., missing dependencies), update the container image.&lt;/li&gt;
&lt;li&gt;If logs show &lt;strong&gt;connection refused&lt;/strong&gt;, check &lt;strong&gt;Service &amp;amp; Networking&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  &lt;strong&gt;🔹 3. Check Pod Events &amp;amp; Describe Pod&lt;/strong&gt;
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;kubectl describe pod &amp;lt;pod-name&amp;gt; &lt;span class="nt"&gt;-n&lt;/span&gt; &amp;lt;namespace&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Look for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;"FailedMount"&lt;/strong&gt; (Persistent Volume issue)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;"FailedScheduling"&lt;/strong&gt; (Node scheduling issue)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;"OOMKilled"&lt;/strong&gt; (Out of Memory)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;💡 &lt;strong&gt;Fix:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;FailedMount?&lt;/strong&gt; Check if Persistent Volume is correctly attached.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;OOMKilled?&lt;/strong&gt; Increase memory limits in the pod spec.&lt;/li&gt;
&lt;/ul&gt;


&lt;h2&gt;
  
  
  &lt;strong&gt;🖧 Step 2: Troubleshooting Service &amp;amp; Networking Issues&lt;/strong&gt;
&lt;/h2&gt;
&lt;h3&gt;
  
  
  &lt;strong&gt;🔹 1. Check Service Details&lt;/strong&gt;
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;kubectl get svc &lt;span class="nt"&gt;-A&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Verify if:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Type:&lt;/strong&gt; ClusterIP, NodePort, LoadBalancer is correct&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;EXTERNAL-IP&lt;/strong&gt; is assigned (for LoadBalancer services)&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  &lt;strong&gt;🔹 2. Check Service Endpoints&lt;/strong&gt;
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;kubectl get endpoints &lt;span class="nt"&gt;-A&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;💡 If there are &lt;strong&gt;no endpoints&lt;/strong&gt;, your service is not connecting to pods.&lt;/p&gt;
&lt;h3&gt;
  
  
  &lt;strong&gt;🔹 3. Manually Test Service Connectivity&lt;/strong&gt;
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;kubectl &lt;span class="nb"&gt;exec&lt;/span&gt; &lt;span class="nt"&gt;-it&lt;/span&gt; &amp;lt;pod-name&amp;gt; &lt;span class="nt"&gt;--&lt;/span&gt; curl http://&amp;lt;service-ip&amp;gt;:&amp;lt;port&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;💡 &lt;strong&gt;Fix:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If &lt;code&gt;curl&lt;/code&gt; fails, check if the &lt;strong&gt;Service Selector&lt;/strong&gt; correctly maps to pods.&lt;/li&gt;
&lt;li&gt;If using &lt;strong&gt;CoreDNS&lt;/strong&gt;, verify it’s running:
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;kubectl get pods &lt;span class="nt"&gt;-n&lt;/span&gt; kube-system | &lt;span class="nb"&gt;grep &lt;/span&gt;coredns
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  &lt;strong&gt;🖥️ Step 3: Troubleshooting Node Issues&lt;/strong&gt;
&lt;/h2&gt;
&lt;h3&gt;
  
  
  &lt;strong&gt;🔹 1. Check Node Status&lt;/strong&gt;
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;kubectl get nodes
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;If a node is &lt;code&gt;NotReady&lt;/code&gt;, check its events:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;kubectl describe node &amp;lt;node-name&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;💡 &lt;strong&gt;Possible Errors &amp;amp; Fixes:&lt;/strong&gt;&lt;br&gt;
| Issue  | Cause | Fix |&lt;br&gt;
|--------|-------|------|&lt;br&gt;
| &lt;code&gt;NotReady&lt;/code&gt; | Kubelet crash | Restart Kubelet: &lt;code&gt;sudo systemctl restart kubelet&lt;/code&gt; |&lt;br&gt;
| &lt;code&gt;DiskPressure&lt;/code&gt; | Node out of disk | Clean logs: &lt;code&gt;sudo du -sh /var/lib/docker&lt;/code&gt; |&lt;br&gt;
| &lt;code&gt;MemoryPressure&lt;/code&gt; | Insufficient memory | Increase node memory in cloud provider |&lt;/p&gt;
&lt;h3&gt;
  
  
  &lt;strong&gt;🔹 2. Check Kubelet Logs&lt;/strong&gt;
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;journalctl &lt;span class="nt"&gt;-u&lt;/span&gt; kubelet &lt;span class="nt"&gt;-n&lt;/span&gt; 50
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;If Kubelet is &lt;strong&gt;not responding&lt;/strong&gt;, restart it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;systemctl restart kubelet
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  &lt;strong&gt;⚙️ Step 4: Troubleshooting Control Plane Issues&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;If your API server is down, the entire cluster becomes unresponsive.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;🔹 1. Check API Server Logs&lt;/strong&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;kubectl cluster-info
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If the API server is not reachable, check logs:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;journalctl &lt;span class="nt"&gt;-u&lt;/span&gt; kube-apiserver &lt;span class="nt"&gt;-n&lt;/span&gt; 50
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;💡 &lt;strong&gt;Fix:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If etcd is failing, restart it:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;systemctl restart etcd
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Check if control plane nodes are under &lt;strong&gt;resource constraints&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;💾 Step 5: Troubleshooting Persistent Storage Issues&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;If your pods are stuck in &lt;strong&gt;"ContainerCreating"&lt;/strong&gt; due to volume issues:&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;🔹 1. Check Persistent Volume (PV) and Claim (PVC)&lt;/strong&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;kubectl get pv,pvc &lt;span class="nt"&gt;-A&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;💡 &lt;strong&gt;Fix:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If PVC is &lt;code&gt;Pending&lt;/code&gt;, check storage class:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;kubectl get storageclass
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;If disk is full, expand storage.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;🛠️ Best Practices for Troubleshooting Kubernetes&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;🔹 &lt;strong&gt;Enable Logging &amp;amp; Monitoring&lt;/strong&gt; (&lt;code&gt;kubectl logs&lt;/code&gt;, Prometheus, Loki)&lt;br&gt;
🔹 &lt;strong&gt;Use &lt;code&gt;kubectl get events&lt;/code&gt; for real-time issues&lt;/strong&gt;&lt;br&gt;
🔹 &lt;strong&gt;Keep your cluster nodes updated&lt;/strong&gt;&lt;br&gt;
🔹 &lt;strong&gt;Automate Scaling&lt;/strong&gt; (Horizontal Pod Autoscaler)&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;🚀 Conclusion&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Troubleshooting Kubernetes requires &lt;strong&gt;systematic debugging of pods, services, nodes, and control plane components&lt;/strong&gt;. Using tools like &lt;code&gt;kubectl logs&lt;/code&gt;, &lt;code&gt;kubectl describe&lt;/code&gt;, and monitoring solutions like &lt;strong&gt;Prometheus&lt;/strong&gt; can help detect and resolve issues quickly.&lt;/p&gt;

</description>
      <category>kubernetes</category>
      <category>devops</category>
      <category>cloudcomputing</category>
      <category>troubleshooting</category>
    </item>
    <item>
      <title>A Complete Guide to Docker: Images, Containers, Networking, and Volumes</title>
      <dc:creator>Kuldeepkumhar-fs</dc:creator>
      <pubDate>Tue, 25 Feb 2025 17:19:43 +0000</pubDate>
      <link>https://dev.to/kuldeepkumharfs/a-complete-guide-to-docker-images-containers-networking-and-volumes-2pli</link>
      <guid>https://dev.to/kuldeepkumharfs/a-complete-guide-to-docker-images-containers-networking-and-volumes-2pli</guid>
      <description>&lt;h1&gt;
  
  
  A Complete Guide to Docker: Images, Containers, Networking, and Volumes
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Topics Covered
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Introduction to Docker&lt;/li&gt;
&lt;li&gt;Working with Docker Images&lt;/li&gt;
&lt;li&gt;Managing Docker Containers&lt;/li&gt;
&lt;li&gt;Docker Networking&lt;/li&gt;
&lt;li&gt;Persistent Storage with Docker Volumes&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Docker has revolutionized the way we develop, deploy, and manage applications by containerizing them. It allows developers to package applications along with their dependencies into lightweight, portable containers that can run anywhere.&lt;/p&gt;

&lt;p&gt;In this guide, we'll explore Docker fundamentals, including &lt;strong&gt;Docker images, containers, networking, and volumes&lt;/strong&gt;, with practical commands and explanations.&lt;/p&gt;




&lt;h2&gt;
  
  
  1. What is Docker?
&lt;/h2&gt;

&lt;p&gt;Docker is an open-source platform that enables developers to automate the deployment of applications inside lightweight, portable containers.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Why Use Docker?&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Portability&lt;/strong&gt;: Containers run the same way across different environments.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Scalability&lt;/strong&gt;: Easily scale applications up or down.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Efficiency&lt;/strong&gt;: Uses fewer resources compared to virtual machines.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Isolation&lt;/strong&gt;: Each container runs independently.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Basic Docker Commands&lt;/strong&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Check Docker version&lt;/span&gt;
docker &lt;span class="nt"&gt;--version&lt;/span&gt;

&lt;span class="c"&gt;# Check system-wide Docker info&lt;/span&gt;
docker info

&lt;span class="c"&gt;# List all available commands&lt;/span&gt;
docker &lt;span class="nb"&gt;help&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  2. Working with Docker Images
&lt;/h2&gt;

&lt;p&gt;A &lt;strong&gt;Docker image&lt;/strong&gt; is a lightweight, standalone, and executable software package that includes everything needed to run a piece of software.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Docker Image Commands&lt;/strong&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Search for an image from Docker Hub&lt;/span&gt;
docker search ubuntu

&lt;span class="c"&gt;# Download (pull) an image from Docker Hub&lt;/span&gt;
docker pull ubuntu

&lt;span class="c"&gt;# List all downloaded images&lt;/span&gt;
docker images

&lt;span class="c"&gt;# Remove an image&lt;/span&gt;
docker rmi ubuntu
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;strong&gt;Create a Custom Docker Image&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;You can create your own image using a &lt;strong&gt;Dockerfile&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example Dockerfile:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight docker"&gt;&lt;code&gt;&lt;span class="c"&gt;# Use Ubuntu as the base image&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt;&lt;span class="s"&gt; ubuntu:latest&lt;/span&gt;

&lt;span class="c"&gt;# Install dependencies&lt;/span&gt;
&lt;span class="k"&gt;RUN &lt;/span&gt;apt-get update &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; apt-get &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-y&lt;/span&gt; curl

&lt;span class="c"&gt;# Set working directory&lt;/span&gt;
&lt;span class="k"&gt;WORKDIR&lt;/span&gt;&lt;span class="s"&gt; /app&lt;/span&gt;

&lt;span class="c"&gt;# Copy files to the container&lt;/span&gt;
&lt;span class="k"&gt;COPY&lt;/span&gt;&lt;span class="s"&gt; . /app&lt;/span&gt;

&lt;span class="c"&gt;# Set default command&lt;/span&gt;
&lt;span class="k"&gt;CMD&lt;/span&gt;&lt;span class="s"&gt; ["bash"]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Build and Run the Image:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Build an image from the Dockerfile&lt;/span&gt;
docker build &lt;span class="nt"&gt;-t&lt;/span&gt; my-custom-image &lt;span class="nb"&gt;.&lt;/span&gt;

&lt;span class="c"&gt;# Run a container from the custom image&lt;/span&gt;
docker run &lt;span class="nt"&gt;-it&lt;/span&gt; my-custom-image
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  3. Managing Docker Containers
&lt;/h2&gt;

&lt;p&gt;A &lt;strong&gt;Docker container&lt;/strong&gt; is a running instance of a Docker image.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Basic Container Commands&lt;/strong&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Run a container from an image&lt;/span&gt;
docker run &lt;span class="nt"&gt;-it&lt;/span&gt; ubuntu

&lt;span class="c"&gt;# Run a container in detached mode (-d runs it in the background)&lt;/span&gt;
docker run &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="nt"&gt;--name&lt;/span&gt; my-container ubuntu

&lt;span class="c"&gt;# List running containers&lt;/span&gt;
docker ps

&lt;span class="c"&gt;# List all containers (including stopped ones)&lt;/span&gt;
docker ps &lt;span class="nt"&gt;-a&lt;/span&gt;

&lt;span class="c"&gt;# Stop a running container&lt;/span&gt;
docker stop my-container

&lt;span class="c"&gt;# Remove a container&lt;/span&gt;
docker &lt;span class="nb"&gt;rm &lt;/span&gt;my-container
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  4. Docker Networking
&lt;/h2&gt;

&lt;p&gt;Docker networking allows containers to communicate with each other and external systems.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;List Networks&lt;/strong&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker network &lt;span class="nb"&gt;ls&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;strong&gt;Create a New Network&lt;/strong&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker network create my_custom_network
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;strong&gt;Run a Container in a Specific Network&lt;/strong&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker run &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="nt"&gt;--name&lt;/span&gt; container1 &lt;span class="nt"&gt;--network&lt;/span&gt; my_custom_network nginx
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;strong&gt;Connect an Existing Container to a Network&lt;/strong&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker network connect my_custom_network container1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;strong&gt;Inspect Network Details&lt;/strong&gt;
&lt;/h3&gt;



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

&lt;/div&gt;






&lt;h2&gt;
  
  
  5. Docker Volumes (Persistent Storage)
&lt;/h2&gt;

&lt;p&gt;Docker &lt;strong&gt;volumes&lt;/strong&gt; are used to persist data across container restarts.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;List Volumes&lt;/strong&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker volume &lt;span class="nb"&gt;ls&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;strong&gt;Create a Volume&lt;/strong&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker volume create my_volume
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;strong&gt;Run a Container with a Mounted Volume&lt;/strong&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker run &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="nt"&gt;-v&lt;/span&gt; my_volume:/data &lt;span class="nt"&gt;--name&lt;/span&gt; my_container ubuntu
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;strong&gt;Inspect Volume Details&lt;/strong&gt;
&lt;/h3&gt;



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

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;strong&gt;Remove a Volume&lt;/strong&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker volume &lt;span class="nb"&gt;rm &lt;/span&gt;my_volume
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Docker simplifies the deployment and management of applications by containerizing them. Understanding &lt;strong&gt;images, containers, networking, and volumes&lt;/strong&gt; is essential for efficient use of Docker in development and production environments.&lt;/p&gt;

&lt;p&gt;By mastering these concepts and commands, you'll be well-equipped to work with Docker and deploy applications seamlessly!&lt;/p&gt;

&lt;p&gt;🚀 &lt;strong&gt;Happy Dockering!&lt;/strong&gt; 🚀&lt;/p&gt;




&lt;p&gt;📌 &lt;strong&gt;Where to Learn More?&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://docs.docker.com/" rel="noopener noreferrer"&gt;Docker Official Docs&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://hub.docker.com/" rel="noopener noreferrer"&gt;Docker Hub&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

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