<?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[Blog Exisf]]></title><description><![CDATA[Information technology]]></description><link>https://blog.exisf.com</link><generator>RSS for Node</generator><lastBuildDate>Sun, 11 Oct 2026 18:27:10 GMT</lastBuildDate><atom:link href="https://blog.exisf.com/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Setting Up Kubernetes RBAC]]></title><description><![CDATA[In Kubernetes, fine-grained access control is essential for securing cluster resources and defining who can do what. Role-Based Access Control (RBAC) is the built-in mechanism that lets you assign permissions to users, groups, and service accounts. I...]]></description><link>https://blog.exisf.com/setting-up-kubernetes-rbac</link><guid isPermaLink="true">https://blog.exisf.com/setting-up-kubernetes-rbac</guid><category><![CDATA[k8s]]></category><category><![CDATA[Kubernetes]]></category><category><![CDATA[#k8scluster]]></category><category><![CDATA[rbac]]></category><category><![CDATA[#RBAC  #Kubernetes]]></category><category><![CDATA[KUBER]]></category><category><![CDATA[serviceaccount]]></category><category><![CDATA[cluster]]></category><category><![CDATA[role-based-access-control]]></category><category><![CDATA[kubernetes rolebindings]]></category><category><![CDATA[rolebinding]]></category><dc:creator><![CDATA[Exisf]]></dc:creator><pubDate>Thu, 26 Sep 2024 23:00:00 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1743167457497/cd91670c-9af6-401e-ba70-f1e399a07103.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>In Kubernetes, fine-grained access control is essential for securing cluster resources and defining who can do what. Role-Based Access Control (RBAC) is the built-in mechanism that lets you assign permissions to users, groups, and service accounts. In this guide, we’ll walk through the process of setting up RBAC for a service account by creating a <code>ClusterRole</code>, binding it with a <code>ClusterRoleBinding</code>, and extracting the token and certificate from a secret for API access. Whether you're automating tasks, integrating external tools, or simply exploring Kubernetes internals, understanding how to securely authorize service accounts is a vital skill.</p>
<h2 id="heading-step-by-step-setting-up-kubernetes-rbac-for-a-service-account">Step-by-Step: Setting Up Kubernetes RBAC for a Service Account</h2>
<ol>
<li><p><strong>Create a Namespace (Optional but Recommended)</strong></p>
<p> Organizing resources into a namespace helps isolate access <code>vi my-namespace.yaml</code></p>
<pre><code class="lang-yaml"> <span class="hljs-attr">apiVersion:</span> <span class="hljs-string">v1</span>
 <span class="hljs-attr">kind:</span> <span class="hljs-string">Namespace</span>
 <span class="hljs-attr">metadata:</span>
   <span class="hljs-attr">name:</span> <span class="hljs-string">my-namespace</span>
</code></pre>
<p> <strong>Apply with:</strong> <code>kubectl apply -f my-namespace.yaml</code></p>
</li>
<li><p><strong>Create a Service Account</strong> <code>vi my-sa.yaml</code></p>
<pre><code class="lang-yaml"> <span class="hljs-attr">apiVersion:</span> <span class="hljs-string">v1</span>
 <span class="hljs-attr">kind:</span> <span class="hljs-string">ServiceAccount</span>
 <span class="hljs-attr">metadata:</span>
   <span class="hljs-attr">name:</span> <span class="hljs-string">my-service-account</span>
   <span class="hljs-attr">namespace:</span> <span class="hljs-string">my-namespace</span>
</code></pre>
<p> <strong>Apply with:</strong> <code>kubectl apply -f my-sa.yaml</code></p>
</li>
<li><h3 id="heading-define-a-clusterrole"><strong>Define a ClusterRole</strong></h3>
<p> This grants permissions across the entire cluster. Here’s an example with read access to all pods: <code>vi my-cr.yaml</code></p>
<pre><code class="lang-yaml"> <span class="hljs-attr">apiVersion:</span> <span class="hljs-string">rbac.authorization.k8s.io/v1</span> 
 <span class="hljs-attr">kind:</span> <span class="hljs-string">ClusterRole</span> 
 <span class="hljs-attr">metadata:</span> 
   <span class="hljs-attr">name:</span> <span class="hljs-string">pod-reader</span> 
 <span class="hljs-attr">rules:</span>
   <span class="hljs-bullet">-</span> <span class="hljs-attr">apiGroups:</span> [<span class="hljs-string">""</span>] 
      <span class="hljs-attr">resources:</span> [<span class="hljs-string">"pods"</span>] 
      <span class="hljs-attr">verbs:</span> [<span class="hljs-string">"get"</span>, <span class="hljs-string">"list"</span>, <span class="hljs-string">"watch"</span>]
</code></pre>
<p> <strong>Apply with:</strong> <code>kubectl apply -f my-cr.yaml</code></p>
</li>
<li><p>Bind the ClusterRole to the Service Account <code>vi my-crb.yaml</code></p>
<pre><code class="lang-yaml"> <span class="hljs-attr">apiVersion:</span> <span class="hljs-string">rbac.authorization.k8s.io/v1</span>
 <span class="hljs-attr">kind:</span> <span class="hljs-string">ClusterRoleBinding</span>
 <span class="hljs-attr">metadata:</span>
   <span class="hljs-attr">name:</span> <span class="hljs-string">read-pods-global</span>
 <span class="hljs-attr">subjects:</span>
 <span class="hljs-bullet">-</span> <span class="hljs-attr">kind:</span> <span class="hljs-string">ServiceAccount</span>
   <span class="hljs-attr">name:</span> <span class="hljs-string">my-service-account</span>
   <span class="hljs-attr">namespace:</span> <span class="hljs-string">my-namespace</span>
 <span class="hljs-attr">roleRef:</span>
   <span class="hljs-attr">kind:</span> <span class="hljs-string">ClusterRole</span>
   <span class="hljs-attr">name:</span> <span class="hljs-string">pod-reader</span>
   <span class="hljs-attr">apiGroup:</span> <span class="hljs-string">rbac.authorization.k8s.io</span>
</code></pre>
</li>
</ol>
<p><strong>Apply with:</strong> <code>kubectl apply -f my-cr.yaml</code></p>
<h3 id="heading-test-if-the-service-account-can-perform-required-action">Test if the service account can perform required action</h3>
<pre><code class="lang-bash">kubectl auth can-i &lt;verb&gt; &lt;resource&gt; --as=system:serviceaccount:&lt;namespace&gt;:&lt;serviceaccount&gt;
</code></pre>
<p>Replace the placeholders as follows:</p>
<ul>
<li><p><code>&lt;verb&gt;</code> – the action to test, e.g., <code>list</code>, <code>get</code>, <code>create</code>, <code>delete</code></p>
</li>
<li><p><code>&lt;resource&gt;</code> – the Kubernetes resource, e.g., <code>pods</code>, <code>secrets</code>, <code>configmaps</code></p>
</li>
<li><p><code>&lt;namespace&gt;</code> – the namespace where the service account resides</p>
</li>
<li><p><code>&lt;serviceaccount&gt;</code> – the name of the service account you're testing</p>
</li>
</ul>
<h3 id="heading-up-next-extracting-tokens-and-ca-certs-from-kubernetes-service-accounts">Up Next: Extracting Tokens and CA Certs from Kubernetes Service Accounts</h3>
<p>In the next post, I’ll cover <strong>how to extract service account tokens and certificates</strong> depending on your Kubernetes version:</p>
<ul>
<li><p><strong>For Kubernetes &lt; 1.24</strong>: Using auto-generated secrets.</p>
</li>
<li><p><strong>For Kubernetes 1.24+</strong>: Using <code>kubectl create token</code> or manually creating a <code>Secret</code> of type <a target="_blank" href="http://kubernetes.io/service-account-token"><code>kubernetes.io/service-account-token</code></a>.</p>
</li>
</ul>
<p>You’ll also learn how to use these credentials to configure a custom <code>kubeconfig</code> file for accessing the cluster via <code>kubectl</code> or automation tools.</p>
]]></content:encoded></item><item><title><![CDATA[Mastering kubectl: The Guide to Kubernetes CLI Commands]]></title><description><![CDATA[Whether you’re just stepping into Kubernetes or you're managing large-scale production clusters, kubectl is your essential Swiss Army knife. It’s the command-line tool used to interact with your Kubernetes cluster, allowing you to deploy apps, inspec...]]></description><link>https://blog.exisf.com/mastering-kubectl-the-guide-to-kubernetes-cli-commands</link><guid isPermaLink="true">https://blog.exisf.com/mastering-kubectl-the-guide-to-kubernetes-cli-commands</guid><category><![CDATA[comman]]></category><category><![CDATA[k8s]]></category><category><![CDATA[Devops]]></category><category><![CDATA[kubectl]]></category><dc:creator><![CDATA[Exisf]]></dc:creator><pubDate>Wed, 12 Jun 2024 23:00:00 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1743169544083/965b36b5-8d0d-48ed-8d48-b37097c06442.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Whether you’re just stepping into Kubernetes or you're managing large-scale production clusters, <code>kubectl</code> is your essential Swiss Army knife. It’s the command-line tool used to interact with your Kubernetes cluster, allowing you to deploy apps, inspect resources, troubleshoot issues, and automate workflows.</p>
<p>In this comprehensive guide, we’ll walk through <code>kubectl</code> command, grouped by purpose, with clear explanations of what each one does.</p>
<hr />
<h2 id="heading-1-cluster-configuration-and-context-management">1. Cluster Configuration and Context Management</h2>
<p>These commands help you connect to, configure, and switch between Kubernetes clusters.</p>
<ul>
<li><p><code>kubectl version</code><br />  Shows the version of <code>kubectl</code> and the connected Kubernetes API server.</p>
</li>
<li><p><code>kubectl config view</code><br />  Displays the kubeconfig file details (clusters, contexts, users).</p>
</li>
<li><p><code>kubectl config use-context &lt;context-name&gt;</code><br />  Switches the current context to a different cluster.</p>
</li>
<li><p><code>kubectl config get-contexts</code><br />  Lists all available contexts in your kubeconfig.</p>
</li>
<li><p><code>kubectl config current-context</code><br />  Prints the name of the current context.</p>
</li>
<li><p><code>kubectl cluster-info</code><br />  Displays addresses of the Kubernetes control plane and services.</p>
</li>
<li><p><code>kubectl config set-context &lt;name&gt;</code><br />  Sets a named context in your kubeconfig.</p>
</li>
</ul>
<hr />
<h2 id="heading-2-listing-and-describing-resources">2. Listing and Describing Resources</h2>
<p>Used for inspecting the current state of your cluster’s resources.</p>
<ul>
<li><p><code>kubectl get &lt;resource&gt;</code><br />  Lists one or more resources (e.g., <code>pods</code>, <code>services</code>, <code>deployments</code>).</p>
</li>
<li><p><code>kubectl get &lt;resource&gt; -o wide</code><br />  Adds more detail to the output (IP, node name, etc.).</p>
</li>
<li><p><code>kubectl get &lt;resource&gt; -A</code><br />  Shows resources across all namespaces.</p>
</li>
<li><p><code>kubectl get all</code><br />  Lists all standard resources (pods, services, deployments, etc.) in the current namespace.</p>
</li>
<li><p><code>kubectl describe &lt;resource&gt; &lt;name&gt;</code><br />  Shows detailed information about a resource, including events and configuration.</p>
</li>
<li><p><code>kubectl explain &lt;resource&gt;</code><br />  Displays the API documentation for the resource type and fields.</p>
</li>
<li><p><code>kubectl get events</code><br />  Lists cluster events in chronological order.</p>
</li>
<li><p><code>kubectl get componentstatuses</code> <em>(deprecated)</em><br />  Shows the health of cluster components (controller manager, scheduler, etc.).</p>
</li>
</ul>
<hr />
<h2 id="heading-3-creating-applying-and-deleting-resources">3. Creating, Applying, and Deleting Resources</h2>
<p>For managing resource lifecycles from YAML or JSON files.</p>
<ul>
<li><p><code>kubectl create -f &lt;file&gt;.yaml</code><br />  Creates resources defined in a manifest file.</p>
</li>
<li><p><code>kubectl apply -f &lt;file&gt;.yaml</code><br />  Creates or updates resources declaratively.</p>
</li>
<li><p><code>kubectl delete -f &lt;file&gt;.yaml</code><br />  Deletes resources defined in the file.</p>
</li>
<li><p><code>kubectl replace -f &lt;file&gt;.yaml</code><br />  Replaces the live resource with a new one from a file.</p>
</li>
<li><p><code>kubectl create deployment &lt;name&gt; --image=&lt;image&gt;</code><br />  Imperatively creates a deployment.</p>
</li>
<li><p><code>kubectl delete &lt;resource&gt; &lt;name&gt;</code><br />  Deletes a specific resource by name.</p>
</li>
<li><p><code>kubectl delete &lt;resource&gt; --all</code><br />  Deletes all resources of a type in the current namespace.</p>
</li>
</ul>
<hr />
<h2 id="heading-4-editing-and-patching-resources">4. Editing and Patching Resources</h2>
<p>For quick changes to live resources.</p>
<ul>
<li><p><code>kubectl edit &lt;resource&gt; &lt;name&gt;</code><br />  Opens the resource definition in your editor for inline editing.</p>
</li>
<li><p><code>kubectl patch &lt;resource&gt; &lt;name&gt; -p '&lt;patch-data&gt;'</code><br />  Applies a strategic merge patch to a resource.</p>
</li>
</ul>
<hr />
<h2 id="heading-5-working-with-pods">5. Working with Pods</h2>
<p>Manage and troubleshoot pods with these commands.</p>
<ul>
<li><p><code>kubectl get pods</code><br />  Lists pods in the current namespace.</p>
</li>
<li><p><code>kubectl logs &lt;pod&gt;</code><br />  Displays logs from a pod's main container.</p>
</li>
<li><p><code>kubectl logs &lt;pod&gt; -c &lt;container&gt;</code><br />  Shows logs from a specific container in the pod.</p>
</li>
<li><p><code>kubectl exec &lt;pod&gt; -- &lt;command&gt;</code><br />  Runs a command inside the pod (e.g., <code>kubectl exec pod-name -- ls /</code>).</p>
</li>
<li><p><code>kubectl exec -it &lt;pod&gt; -- bash</code><br />  Opens an interactive terminal session inside the container.</p>
</li>
<li><p><code>kubectl port-forward &lt;pod&gt; 8080:80</code><br />  Forwards a local port to a port on the pod.</p>
</li>
<li><p><code>kubectl cp &lt;pod&gt;:&lt;path&gt; &lt;local-path&gt;</code><br />  Copies files from a pod to the local machine or vice versa.</p>
</li>
<li><p><code>kubectl delete pod &lt;name&gt;</code><br />  Deletes a specific pod.</p>
</li>
<li><p><code>kubectl delete pod --all</code><br />  Deletes all pods in the current namespace.</p>
</li>
</ul>
<hr />
<h2 id="heading-6-deployments-and-rollouts">6. Deployments and Rollouts</h2>
<p>Commands for managing application rollouts.</p>
<ul>
<li><p><code>kubectl rollout status deployment/&lt;name&gt;</code><br />  Monitors the rollout status of a deployment.</p>
</li>
<li><p><code>kubectl rollout history deployment/&lt;name&gt;</code><br />  Shows the history of a deployment.</p>
</li>
<li><p><code>kubectl rollout undo deployment/&lt;name&gt;</code><br />  Rolls back to the previous deployment.</p>
</li>
<li><p><code>kubectl rollout restart deployment/&lt;name&gt;</code><br />  Triggers a new rollout by restarting the deployment.</p>
</li>
<li><p><code>kubectl scale deployment &lt;name&gt; --replicas=&lt;n&gt;</code><br />  Changes the number of pod replicas in a deployment.</p>
</li>
</ul>
<hr />
<h2 id="heading-7-services-and-exposing-pods">7. Services and Exposing Pods</h2>
<p>Use these to expose pods and create services.</p>
<ul>
<li><p><code>kubectl expose pod &lt;name&gt; --port=80 --target-port=8080</code><br />  Exposes a pod as a service.</p>
</li>
<li><p><code>kubectl expose deployment &lt;name&gt; --port=80 --type=NodePort</code><br />  Exposes a deployment through a service.</p>
</li>
</ul>
<hr />
<h2 id="heading-8-namespaces">8. Namespaces</h2>
<p>Commands for managing namespaces.</p>
<ul>
<li><p><code>kubectl get namespaces</code><br />  Lists all namespaces.</p>
</li>
<li><p><code>kubectl create namespace &lt;name&gt;</code><br />  Creates a new namespace.</p>
</li>
<li><p><code>kubectl delete namespace &lt;name&gt;</code><br />  Deletes the specified namespace.</p>
</li>
<li><p><code>kubectl get pods --namespace &lt;name&gt;</code><br />  Lists pods in a specific namespace.</p>
</li>
</ul>
<hr />
<h2 id="heading-9-labels-and-annotations">9. Labels and Annotations</h2>
<p>Used to organize and identify Kubernetes resources.</p>
<ul>
<li><p><code>kubectl label &lt;resource&gt; &lt;name&gt; key=value</code><br />  Adds or updates a label on a resource.</p>
</li>
<li><p><code>kubectl annotate &lt;resource&gt; &lt;name&gt; key=value</code><br />  Adds or updates an annotation.</p>
</li>
</ul>
<hr />
<h2 id="heading-10-resource-usage">10. Resource Usage</h2>
<p>Check CPU and memory consumption.</p>
<ul>
<li><p><code>kubectl top pod</code><br />  Shows CPU and memory usage of pods.</p>
</li>
<li><p><code>kubectl top node</code><br />  Shows CPU and memory usage of nodes.</p>
</li>
</ul>
<p><em>(Requires metrics server to be installed.)</em></p>
<hr />
<h2 id="heading-11-access-control-and-security-rbac">11. Access Control and Security (RBAC)</h2>
<p>Useful for debugging permissions and managing roles.</p>
<ul>
<li><p><code>kubectl auth can-i &lt;verb&gt; &lt;resource&gt;</code><br />  Checks whether the current user is allowed to perform an action.</p>
</li>
<li><p><code>kubectl describe role &lt;name&gt;</code><br />  Describes a Role's permissions.</p>
</li>
<li><p><code>kubectl describe clusterrole &lt;name&gt;</code><br />  Describes a ClusterRole's permissions.</p>
</li>
<li><p><code>kubectl get roles</code> / <code>kubectl get clusterroles</code><br />  Lists roles and cluster-wide roles.</p>
</li>
</ul>
<hr />
<h2 id="heading-12-output-customization-and-sorting">12. Output Customization and Sorting</h2>
<p>Get more detailed or structured output.</p>
<ul>
<li><p><code>kubectl get &lt;resource&gt; -o yaml</code><br />  Outputs the resource definition in YAML format.</p>
</li>
<li><p><code>kubectl get &lt;resource&gt; -o json</code><br />  Outputs the resource definition in JSON format.</p>
</li>
<li><p><code>kubectl get &lt;resource&gt; --sort-by=.</code><a target="_blank" href="http://metadata.name"><code>metadata.name</code></a><br />  Sorts the resource list by a field.</p>
</li>
<li><p><code>kubectl get &lt;resource&gt; -l key=value</code><br />  Filters by label selector.</p>
</li>
</ul>
<hr />
<p><code>kubectl</code> is powerful because it abstracts Kubernetes operations into a unified CLI. From basic pod management to advanced rollout strategies and RBAC validation, mastering <code>kubectl</code> is essential for efficient Kubernetes operations. As Kubernetes evolves, keep an eye on updates and new flags, but this foundation will always serve you well.</p>
]]></content:encoded></item><item><title><![CDATA[Guide on How to Deploy a Private Container Registry]]></title><description><![CDATA[Private registries are used to store and distribute Docker images within your organization, providing control and security over your containerized applications. It is a common task when working with containerization technologies like Docker. In this ...]]></description><link>https://blog.exisf.com/guide-on-how-to-deploy-a-private-container-registry</link><guid isPermaLink="true">https://blog.exisf.com/guide-on-how-to-deploy-a-private-container-registry</guid><category><![CDATA[registry]]></category><category><![CDATA[Docker]]></category><category><![CDATA[Kubernetes]]></category><category><![CDATA[containers]]></category><category><![CDATA[private-registry]]></category><dc:creator><![CDATA[Exisf]]></dc:creator><pubDate>Tue, 12 Sep 2023 23:00:00 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1695226118256/df5a9e6d-734d-46e5-ba1c-b37712ecf5b8.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Private registries are used to store and distribute Docker images within your organization, providing control and security over your containerized applications. It is a common task when working with containerization technologies like Docker. In this post, I'll walk you through the steps to set up a private Docker registry.</p>
<p>There are various tools available for creating private registries, and Docker itself provides a registry image called Docker Registry. We will focus on using Docker Registry, depending on your needs, you may also explore Harbor, Artifactory, or Azure Container Registry.</p>
<p><strong>Prerequisites:</strong></p>
<ol>
<li><p>A Linux host where you'll host the private registry.</p>
</li>
<li><p>Docker is installed on the host.</p>
</li>
<li><p>Docker Compose installed (optional but recommended for ease of management).</p>
</li>
</ol>
<p>Here are the steps:</p>
<p><strong>Install Docker Registry:</strong></p>
<p>You can use Docker Compose to easily set up the Docker Registry. Create a <code>docker-compose.yml</code> file with the following content</p>
<pre><code class="lang-yaml"><span class="hljs-attr">version:</span> <span class="hljs-string">'3'</span>
<span class="hljs-attr">services:</span>
  <span class="hljs-attr">registry:</span>
    <span class="hljs-attr">image:</span> <span class="hljs-string">registry:2</span>
    <span class="hljs-attr">ports:</span>
      <span class="hljs-bullet">-</span> <span class="hljs-number">5000</span><span class="hljs-string">:5000</span>
    <span class="hljs-attr">environment:</span>
      <span class="hljs-attr">REGISTRY_STORAGE_FILESYSTEM_ROOTDIRECTORY:</span> <span class="hljs-string">/var/lib/registry</span>
</code></pre>
<p><strong>Configure TLS (Optional but recommended):</strong></p>
<p>It is strongly advised that you configure TLS to secure your private registry. You can use tools like certbot or generate a self-signed certificates. Then, update the TLS configuration to your docker-compose.yml file.</p>
<pre><code class="lang-yaml"><span class="hljs-attr">version:</span> <span class="hljs-string">'3'</span>
<span class="hljs-attr">services:</span>
  <span class="hljs-attr">registry:</span>
    <span class="hljs-attr">image:</span> <span class="hljs-string">registry:2</span>
    <span class="hljs-attr">ports:</span>
      <span class="hljs-bullet">-</span> <span class="hljs-number">5000</span><span class="hljs-string">:5000</span>
    <span class="hljs-attr">environment:</span>
      <span class="hljs-attr">REGISTRY_STORAGE_FILESYSTEM_ROOTDIRECTORY:</span> <span class="hljs-string">/var/lib/registry</span>
    <span class="hljs-attr">volumes:</span>
      <span class="hljs-bullet">-</span> <span class="hljs-string">/path/to/certs:/certs</span>
    <span class="hljs-attr">tls:</span>
      <span class="hljs-attr">certificate:</span> <span class="hljs-string">/certs/your.crt</span>
      <span class="hljs-attr">key:</span> <span class="hljs-string">/certs/your.key</span>
</code></pre>
<p>Replace <code>/path/to/certs</code>, <code>your.crt</code>, and <code>your.key</code> with the actual paths and filenames of your TLS certificates.</p>
<p><strong>Secure the Registry:</strong></p>
<p>To secure the registry, you can set up authentication. Docker Registry supports both basic authentication and token-based authentication. Basic authentication involves creating a <code>htpasswd</code> file, and token-based authentication can be set up using Docker Notary.</p>
<p>For basic authentication, create an <code>htpasswd</code> file and mount it into the registry container. Update your <code>docker-compose.yml</code> to include the authentication:</p>
<pre><code class="lang-yaml"><span class="hljs-attr">version:</span> <span class="hljs-string">'3'</span>
<span class="hljs-attr">services:</span>
  <span class="hljs-attr">registry:</span>
    <span class="hljs-attr">image:</span> <span class="hljs-string">registry:2</span>
    <span class="hljs-attr">ports:</span>
      <span class="hljs-bullet">-</span> <span class="hljs-number">5000</span><span class="hljs-string">:5000</span>
    <span class="hljs-attr">environment:</span>
      <span class="hljs-attr">REGISTRY_STORAGE_FILESYSTEM_ROOTDIRECTORY:</span> <span class="hljs-string">/var/lib/registry</span>
      <span class="hljs-attr">REGISTRY_AUTH:</span> <span class="hljs-string">htpasswd</span>
      <span class="hljs-attr">REGISTRY_AUTH_HTPASSWD_PATH:</span> <span class="hljs-string">/auth/htpasswd</span>
      <span class="hljs-attr">REGISTRY_AUTH_HTPASSWD_REALM:</span> <span class="hljs-string">Registry</span> <span class="hljs-string">Realm</span>
    <span class="hljs-attr">volumes:</span>
      <span class="hljs-bullet">-</span> <span class="hljs-string">/path/to/certs:/certs</span>
      <span class="hljs-bullet">-</span> <span class="hljs-string">/path/to/auth:/auth</span>
    <span class="hljs-attr">tls:</span>
      <span class="hljs-attr">certificate:</span> <span class="hljs-string">/certs/your.crt</span>
      <span class="hljs-attr">key:</span> <span class="hljs-string">/certs/your.key</span>
</code></pre>
<p>Replace <code>/path/to/auth</code> with the path to your <code>htpasswd</code> file.</p>
<p>Save this file and run the registry as a Docker container.</p>
<pre><code class="lang-bash">docker-compose up -d
</code></pre>
<p><strong>Access the Registry:</strong></p>
<p>Once your private registry is up and running, you can login to the registry if authentication was setup, push and pull Docker images to and from it using the following format:</p>
<pre><code class="lang-bash">docker login &lt;registry-host&gt;:5000
docker pull &lt;registry-host&gt;:5000/&lt;image-name&gt;:&lt;tag&gt;
docker push &lt;registry-host&gt;:5000/&lt;image-name&gt;:&lt;tag&gt;
</code></pre>
<p><code>&lt;registry-host&gt;</code> is the hostname or IP address of your private registry server.</p>
<p>That's it! You now have a private Docker registry up and running. Make sure to configure the necessary firewall rules and access controls to restrict access to authorized users only. Additionally, consider setting up regular backups and monitoring your registry to ensure its reliability and security.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1692352819081/adca098a-ec63-435f-b4a0-3c19192c0e73.jpeg" alt class="image--right mx-auto mr-0" /></p>
]]></content:encoded></item><item><title><![CDATA[How to setup  private registry in Kubernetes cluster using cri-o as CRI]]></title><description><![CDATA[Before we begin, there are a few conditions that must be met. We need to have the following in place.

Private container registry setup.

Setup guide: https://blog.exisf.com/guide-on-how-to-deploy-a-private-container-registry


The images are pushed ...]]></description><link>https://blog.exisf.com/how-to-setup-private-registry-in-kubernetes-cluster-using-cri-o-as-cri</link><guid isPermaLink="true">https://blog.exisf.com/how-to-setup-private-registry-in-kubernetes-cluster-using-cri-o-as-cri</guid><category><![CDATA[Docker]]></category><category><![CDATA[#kubernetes #container ]]></category><category><![CDATA[registry]]></category><category><![CDATA[docker-registry]]></category><dc:creator><![CDATA[Exisf]]></dc:creator><pubDate>Sat, 02 Sep 2023 23:00:00 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1694095733877/d0882ec0-f7b8-445d-966e-f26fccc75585.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Before we begin, there are a few conditions that must be met. We need to have the following in place.</p>
<ol>
<li><p>Private container registry setup.</p>
<ul>
<li>Setup guide: <a target="_blank" href="https://blog.exisf.com/guide-on-how-to-deploy-a-private-container-registry">https://blog.exisf.com/guide-on-how-to-deploy-a-private-container-registry</a></li>
</ul>
</li>
<li><p>The images are pushed to the registry.</p>
</li>
<li><p>Have a functioning Kubernetes environment up and running.</p>
</li>
<li><p>Authentication credentials such as username, password, or tokens are needed to access the private registry.</p>
</li>
<li><p>If the private registry uses HTTPS, you may need to manage SSL/TLS certificates. To create a secure connection, Kubernetes must trust the registry's certificate.</p>
</li>
</ol>
<p>With the above in place, we are ready to proceed with this exercise. Let's walk through the process.</p>
<p>In this example, we use a self-hosted docker registry with the URL '<a target="_blank" href="http://gitlab-registry.pipe.co:5555">myregistry.com</a>' listening on port '5000'. Log in to the image registry via the command line. If you do not have the docker tool installed, check below for an optional method to create the secret.</p>
<pre><code class="lang-bash">docker login myregistry.com:5000
</code></pre>
<p>Provide the credential you want to use to authenticate to the registry when prompted, this could be an access token or the password for the docker ID.</p>
<p>The login process creates or updates a <code>config.json</code> file that holds an authorization token usually in the home directory.</p>
<pre><code class="lang-bash">cat <span class="hljs-variable">$HOME</span>/.docker/config.json
</code></pre>
<p>To use the token within Kubernetes, we create a secret based on the credentials above. Kubernetes cluster authenticates with the registry to retrieve images using the secret of <code>kubernetes.io/dockerconfigjson</code> type.</p>
<pre><code class="lang-bash">kubectl create secret generic regcredname  --from-file=.dockerconfigjson=&lt;path/to/.docker/config.json&gt; --<span class="hljs-built_in">type</span>=kubernetes.io/dockerconfigjson
</code></pre>
<p><strong>Optional method to create the secret</strong></p>
<p>If you don't have <code>docker</code> installed, do this instead. Use <code>kubectl</code> to create the secret and store the registry login credentials providing them via the command line. But if you prefer the docker login method then skip this step.</p>
<pre><code class="lang-bash">kubectl create secret docker-registry regcredname --docker-server &lt;your-registry-server&gt; --docker-username=&lt;your-docker-username&gt; --docker-password=&lt;your-docker-password&gt; --docker-email=&lt;your-email&gt;
</code></pre>
<p>Note that secrets typed on the command line may be stored unprotected in your shell history, and those secrets may be available to other users on that host while <code>Kubectl</code> is running.</p>
<p><strong>Use the secret in a Kubernetes manifest file</strong></p>
<p>The following is a manifest for a pod that requires access to the credentials we created in <code>regcredname</code>, to pull the image specified from the private registry.</p>
<p><code>vi my-private-reg-pod.yaml</code></p>
<pre><code class="lang-yaml"><span class="hljs-attr">apiVersion:</span> <span class="hljs-string">v1</span>
<span class="hljs-attr">kind:</span> <span class="hljs-string">Pod</span>
<span class="hljs-attr">metadata:</span>
  <span class="hljs-attr">name:</span> <span class="hljs-string">my-app-priv-reg</span>
<span class="hljs-attr">spec:</span>
  <span class="hljs-attr">containers:</span>
  <span class="hljs-bullet">-</span> <span class="hljs-attr">name:</span> <span class="hljs-string">my-private-reg-image</span>
    <span class="hljs-attr">image:</span> <span class="hljs-string">myregistry.com:5000/my-reg-image:tag</span>
  <span class="hljs-attr">imagePullSecrets:</span>
  <span class="hljs-bullet">-</span> <span class="hljs-attr">name:</span> <span class="hljs-string">regcredname</span>
</code></pre>
<p>Replace <code>myregistry.com:5000/my-reg-image:tag</code> with the actual image.</p>
<p><strong>Update the location of the registry to the Kubernetes registries config file</strong></p>
<p>In the Kubernetes cluster, edit the container registry configuration file and specify the registry URL and SSL/TLS option.</p>
<p>The default location is <code>/etc/containers/registries.conf</code>, If you wish to modify it for a single user, you may create a new file at <code>$HOME/.config/containers/registries.conf</code></p>
<p>Update the <code>[[registry]]</code> section with the URL or IP of the container registry. To skip TLS verification, that is, using HTTP rather than HTTPS to connect to the registry, add <code>insecure=true</code>.</p>
<pre><code class="lang-bash">[[registry]]
location=<span class="hljs-string">"myregistry.com:5000"</span>
insecure=<span class="hljs-literal">true</span>
</code></pre>
<p>If there are numerous registries, the [[registry]] double brackets indicate that we can specify a list or a table of [registry] objects. In this example, there is only one registry <a target="_blank" href="http://myregistry.com:5552">myregistry.com:</a>5000.</p>
<p>After updating the file, restart the CRI-O service to apply the changes</p>
<pre><code class="lang-bash">systemctl restart crio.service
</code></pre>
<p>Finally, deploy the pod to the Kubernetes cluster using <code>kubectl</code> and verify it is running.</p>
<pre><code class="lang-bash">kubectl apply -f my-private-reg-pod.yaml
kubectl get pod my-app-priv-reg
</code></pre>
<p>Now, your Kubernetes pods should be able to pull images from your private container registry with the appropriate authentication credentials. Make sure to replace placeholders with your actual registry and credentials information.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1692352819081/adca098a-ec63-435f-b4a0-3c19192c0e73.jpeg" alt class="image--right mx-auto mr-0" /></p>
]]></content:encoded></item><item><title><![CDATA[Networks: Exploring Docker's Building Blocks - Docker objects]]></title><description><![CDATA[Docker networks are an essential component of Docker's networking capabilities, allowing you to establish and control communication between Docker containers as well as communication between containers and the host system. Docker networks provide iso...]]></description><link>https://blog.exisf.com/networks-exploring-dockers-building-blocks-docker-objects</link><guid isPermaLink="true">https://blog.exisf.com/networks-exploring-dockers-building-blocks-docker-objects</guid><category><![CDATA[Docker]]></category><category><![CDATA[docker-network]]></category><category><![CDATA[docker-bridge-network]]></category><dc:creator><![CDATA[Exisf]]></dc:creator><pubDate>Sun, 20 Aug 2023 23:00:00 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1692826994687/5c4cd45b-b460-4ce1-8292-5277bd690586.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Docker networks are an essential component of Docker's networking capabilities, allowing you to establish and control communication between Docker containers as well as communication between containers and the host system. Docker networks provide isolation, security, and flexibility for containerized applications.</p>
<p>First, we will introduce the fundamental concepts and benefits of Docker networks starting with the default network. Then, in the second section, we delve into hands-on examples and specific commands for working with Docker networks.</p>
<p><strong>Section 1a:</strong></p>
<p><strong>Understanding the Default Bridge Network</strong></p>
<p>When you run a Docker container without specifying a custom network, it is automatically assigned to the "bridge" network. Containers on the same bridge network can communicate with one another directly, but they are isolated from other bridge networks unless port forwarding is configured.</p>
<p><strong>Key Features and Characteristics</strong></p>
<ul>
<li><p>By default, containers linked to the default bridge network are separated from external networks. This separation offers another degree of security by preventing container services from being directly exposed to the host's network interfaces.</p>
</li>
<li><p>Containers connected to the same default bridge network can interact using the internal IP addresses assigned by Docker. This communication is possible through the use of basic networking protocols like HTTP, HTTPS, and others.</p>
</li>
<li><p>Docker assigns unique container names, making it easy for containers to reference each other. This simplifies communication by allowing containers to use these names as hostnames.</p>
</li>
<li><p>The default bridge network also supports port mapping, which allows containers to expose certain ports to the host system or even external networks. This is required if you wish to access containerized services from outside the container.</p>
</li>
</ul>
<p><strong>Use Cases for the Default Bridge Network</strong></p>
<p>The default bridge network is suitable for various scenarios which include:</p>
<ul>
<li><p><strong>Microservices Communication:</strong> Different components of an application can connect over the default bridge network in microservices designs, enabling efficient communication while retaining isolation.</p>
</li>
<li><p><strong>Development and Testing:</strong> Containers on the default bridge network can communicate fluidly during development and testing, simulating a production-like environment without exposing services to the larger network.</p>
</li>
</ul>
<p><strong>Limitations and Considerations</strong></p>
<p>Despite being convenient, the basic bridge network has some drawbacks:</p>
<ul>
<li><p><strong>Container Isolation:</strong> Containers on the default bridge network have a common network namespace, which could restrict security in some circumstances.</p>
</li>
<li><p><strong>No Host Access:</strong> Containers on the default bridge network cannot directly access services on the host system.</p>
</li>
</ul>
<p><strong>Conclusion</strong></p>
<p>The default bridge network in Docker serves as the foundation for container communication on a single host. It provides isolation, container-to-container interaction, and port mapping, making it an integral part of Docker's networking architecture. Understanding the default bridge network is essential for anyone working with Docker containers and building containerized applications.</p>
<p>In our next section 1b, we will explore the custom network types, and highlight the benefits of creating custom bridge networks, features, use cases and limitations. Stay tuned to take your Docker networking skills to the next level!</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1692352819081/adca098a-ec63-435f-b4a0-3c19192c0e73.jpeg" alt /></p>
]]></content:encoded></item><item><title><![CDATA[Container: Exploring Docker's Building Blocks
 - Docker objects]]></title><description><![CDATA[In our last post, we discussed Docker images and how they serve as the essential building blocks of containerization, and how Docker images encapsulate an application along with its dependencies, providing consistency across various environments. As ...]]></description><link>https://blog.exisf.com/container-exploring-dockers-building-blocks-docker-objects</link><guid isPermaLink="true">https://blog.exisf.com/container-exploring-dockers-building-blocks-docker-objects</guid><category><![CDATA[Docker]]></category><category><![CDATA[docker container]]></category><dc:creator><![CDATA[Exisf]]></dc:creator><pubDate>Fri, 18 Aug 2023 16:48:02 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1692826720771/b260e3c1-04b1-48d0-b909-65d78c00f20d.webp" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>In our last post, we discussed Docker images and how they serve as the essential building blocks of containerization, and how Docker images encapsulate an application along with its dependencies, providing consistency across various environments. As a continuation of our Docker journey, this write-up will focus on another important part of the Docker object: Docker containers.</p>
<p><strong>Containers: Dynamic and Agile Application Environments</strong></p>
<p>Think of containers as isolated, lightweight runtime environments for applications. They encapsulate the application, its runtime, system tools, libraries, and settings, providing an efficient and consistent way to deploy applications across various environments.</p>
<p>Containers are engineered for agility and portability. Since they bundle everything needed to run an application, from its dependencies to configuration files, developers can be confident that their code will run consistently across development, testing, and production environments. Containers are isolated from the host system and other containers, ensuring that changes made in one container do not affect others or the underlying host system.</p>
<p><strong>Key Advantages of Containers:</strong></p>
<ol>
<li><p><strong>Resource Efficiency:</strong> Containers share the kernel of the host operating system, reducing overhead and allowing the deployment of multiple programs on the same hardware.</p>
</li>
<li><p><strong>Consistency:</strong> Containers ensure consistent behaviour across diverse environments, eliminating the "it works on my machine" issue.</p>
</li>
<li><p><strong>Rapid Deployment:</strong> Containers can be spun up and torn down quickly, making it easy to scale applications based on demand.</p>
</li>
<li><p><strong>Isolation:</strong> Containers provide isolation between applications, enhancing security and preventing conflicts.</p>
</li>
<li><p><strong>Version Control:</strong> Docker images and containers can be versioned, allowing easy rollback and updates.</p>
</li>
</ol>
<p>Commonly used commands and their use case include.</p>
<ol>
<li><p><strong>docker run:</strong></p>
<ul>
<li><p>Create and start a new container based on an image.</p>
<p>  <code>docker run -it ubuntu:latest bash</code></p>
</li>
</ul>
</li>
<li><p><strong>docker start:</strong></p>
<ul>
<li><p>Start a stopped container.</p>
<p>  <code>docker start container_name</code></p>
</li>
</ul>
</li>
<li><p><strong>docker stop:</strong></p>
<ul>
<li><p>Gracefully stop a running container.</p>
<p>  <code>docker stop container_name</code></p>
</li>
</ul>
</li>
<li><p><strong>docker restart:</strong></p>
<ul>
<li><p>Stop and then start a container.</p>
<p>  <code>docker restart container_name</code></p>
</li>
</ul>
</li>
<li><p><strong>docker pause:</strong></p>
<ul>
<li><p>Pause all processes in a running container.</p>
<p>  <code>docker pause container_name</code></p>
</li>
</ul>
</li>
<li><p><strong>docker unpause:</strong></p>
<ul>
<li><p>Unpause a paused container.</p>
<p>  <code>docker unpause container_name</code></p>
</li>
</ul>
</li>
<li><p><strong>docker kill:</strong></p>
<ul>
<li><p>Forcefully stop a running container.</p>
<p>  <code>docker kill container_name</code></p>
</li>
</ul>
</li>
<li><p><strong>docker exec:</strong></p>
<ul>
<li><p>Run a command inside a running container.</p>
<p>  <code>docker exec -it container_name bash</code></p>
</li>
</ul>
</li>
<li><p><strong>docker attach:</strong></p>
<ul>
<li><p>Attach to a running container's console.</p>
<p>  <code>docker attach container_name</code></p>
</li>
</ul>
</li>
<li><p><strong>docker logs:</strong></p>
<ul>
<li><p>Display logs from a container.</p>
<p>  <code>docker logs container_name</code></p>
</li>
</ul>
</li>
<li><p><strong>docker ps:</strong></p>
<ul>
<li><p>List all running containers.</p>
<p>  <code>docker ps</code></p>
</li>
</ul>
</li>
<li><p><strong>docker ps -a:</strong></p>
<ul>
<li><p>List all containers (both running and stopped).</p>
<p>  <code>docker ps -a</code></p>
</li>
</ul>
</li>
<li><p><strong>docker rm:</strong></p>
<ul>
<li><p>Remove a stopped container.</p>
<p>  <code>docker rm container_name</code></p>
</li>
</ul>
</li>
<li><p><strong>docker commit:</strong></p>
<ul>
<li><p>Create a new image from a container's changes.</p>
<p>  <code>docker commit container_name new_image_name</code></p>
</li>
</ul>
</li>
<li><p><strong>docker inspect:</strong></p>
<ul>
<li><p>Display detailed information about a container.</p>
<p>  <code>docker inspect container_name</code></p>
</li>
</ul>
</li>
<li><p><strong>docker stats:</strong></p>
<ul>
<li><p>Display real-time resource usage statistics for containers.</p>
<p>  <code>docker stats container_name</code></p>
</li>
</ul>
</li>
<li><p><strong>docker top:</strong></p>
<ul>
<li><p>Display the running processes in a container.</p>
<p>  <code>docker top container_name</code></p>
</li>
</ul>
</li>
<li><p><strong>docker rename:</strong></p>
<ul>
<li><p>Rename an existing container.</p>
<p>  <code>docker rename old_container_name new_container_name</code></p>
</li>
</ul>
</li>
<li><p><strong>docker cp:</strong></p>
<ul>
<li><p>Copy files or folders between a container and the local filesystem.</p>
<p>  <code>docker cp container_name:/path/to/file local_path</code></p>
</li>
</ul>
</li>
</ol>
<p>These are just a subset of Docker container commands. Depending on your specific use case, you might find other commands relevant as well. Remember to use <code>docker --help</code> or consult the official Docker documentation for detailed information on each command's options and usage.</p>
<p>While Docker images serve as the blueprint, containers are the dynamic actors that execute the scripts. These components, when combined, constitute the foundation of Docker's containerization method, which is transforming software deployment and development practices. In future articles, we'll go further into another Docker object: Docker networks, Capabilities and how they enable seamless communication and collaboration among containers.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1692352819081/adca098a-ec63-435f-b4a0-3c19192c0e73.jpeg" alt /></p>
]]></content:encoded></item><item><title><![CDATA[Image: Exploring Docker's Building Blocks -
Docker objects]]></title><description><![CDATA[Docker object: We can create, distribute, and run applications in containers with docker. The requirements and configurations required to operate these applications are built within a docker image and run in containers, which are paths of the docker ...]]></description><link>https://blog.exisf.com/image-exploring-dockers-building-blocks-docker-objects</link><guid isPermaLink="true">https://blog.exisf.com/image-exploring-dockers-building-blocks-docker-objects</guid><category><![CDATA[Docker]]></category><category><![CDATA[docker images]]></category><dc:creator><![CDATA[Exisf]]></dc:creator><pubDate>Fri, 11 Aug 2023 17:19:41 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1692826652955/819e80aa-f848-4811-adb8-3ce7056843d6.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><strong>Docker object:</strong> We can create, distribute, and run applications in containers with docker. The requirements and configurations required to operate these applications are built within a docker image and run in containers, which are paths of the docker objects. Docker objects are the various components and entities used within the docker environment. Such as creating and utilising images, containers, networks, volumes, plugins, and other items. Some of the benefits of docker include;</p>
<ul>
<li><p>Consistency</p>
</li>
<li><p>Portability</p>
</li>
<li><p>Resource Efficiency</p>
</li>
<li><p>Versioning and Rollbacks</p>
</li>
<li><p>Rapid Deployment</p>
</li>
</ul>
<p>In this opening post, we will explore some of the most often-used commands related to docker images. How these commands enable us to efficiently manage, manipulate, and interact with docker images, forming the bedrock of containerization technology.</p>
<h3 id="heading-docker-image"><strong>Docker image</strong></h3>
<ul>
<li><p>Provides the blueprint for running containers, and instances of images that are executed in isolated environments.</p>
</li>
<li><p>A standalone package that encapsulates a piece of software, including code, runtime, system tools, libraries, and settings. Once created, it remains unchangeable. Modifications result in new image layers.</p>
</li>
<li><p>Composed of multiple read-only layers that build upon each other build instructions.</p>
</li>
<li><p>Can be created based on another image with custom instructions and configuration parameters required.</p>
</li>
<li><p>Can be moved and deployed across various environments consistently, tagged with versions, making it easy to track and manage changes.</p>
</li>
</ul>
<p>Commonly used commands and their use case includes.</p>
<ol>
<li><p><strong>Docker build:</strong></p>
<ol>
<li><p>Build a docker image from a dockerfile named "my_image" with tag "latest" in the current working directory</p>
<ul>
<li><code>docker image build -t my_image:latest .</code></li>
</ul>
</li>
</ol>
</li>
<li><p><strong>Docker pull:</strong></p>
<ol>
<li><p>Download (pull) the latest version of the nginx image from the docker public Hub</p>
<ul>
<li><code>docker pull nginx:latest</code></li>
</ul>
</li>
<li><p>Download (pull) the latest version of the nginx image from a hosted registry</p>
<ul>
<li><p><code>docker login registry.mydomain.com</code></p>
</li>
<li><p><code>docker pull nginx:latest</code></p>
</li>
</ul>
</li>
</ol>
</li>
<li><p><strong>Docker push:</strong></p>
<ol>
<li><p>Upload or pushes the "my_image" image to a docker registry</p>
<ul>
<li><code>docker push my_image:latest</code></li>
</ul>
</li>
</ol>
</li>
<li><p><strong>Docker image:</strong></p>
<ol>
<li><p>List pulled docker image in the local system with either command</p>
<ul>
<li><p><code>docker images</code></p>
</li>
<li><p><code>docker image ls</code></p>
</li>
</ul>
</li>
</ol>
</li>
<li><p><strong>Docker image remove:</strong></p>
<ol>
<li><p>Remove docker image</p>
<ul>
<li><code>docker image rm my_image:latest</code></li>
</ul>
</li>
</ol>
</li>
<li><p><strong>Docker image prune</strong></p>
<ol>
<li><p>Remove dangling image. A dangling image means images that are not tagged and are not referenced by any container</p>
<ul>
<li><code>docker image prune</code></li>
</ul>
</li>
<li><p>Remove all images which are not used by existing containers</p>
<ul>
<li><code>docker image prune -a</code></li>
</ul>
</li>
</ol>
</li>
<li><p><strong>Docker image inspect:</strong></p>
<ol>
<li><p>Display detailed information on one or more images, e.g my_image:latest</p>
<ul>
<li><code>docker image inspect my_image:latest</code></li>
</ul>
</li>
</ol>
</li>
<li><p><strong>Docker image history:</strong></p>
<ol>
<li><p>Show the history of the "my_image:latest" image layers</p>
<ul>
<li><code>docker image history my_image:latest</code></li>
</ul>
</li>
</ol>
</li>
<li><p><strong>Docker image tag:</strong></p>
<ol>
<li><p>Create a new version tag from an existing image</p>
<ul>
<li><code>docker image tag my_image:latest my_image:v2</code></li>
</ul>
</li>
</ol>
</li>
<li><p><strong>Docker image save:</strong></p>
<ol>
<li><p>Save the image to a tarball archive</p>
<ul>
<li><code>docker image save -o my_image.tar my_image:latest</code></li>
</ul>
</li>
<li><p>This method can also be used to copy images from one host to another</p>
<ol>
<li><p>After saving the image, copy it with <code>cp</code>, <code>scp</code>, <code>rsync</code> or any preferred option to the remote host.</p>
</li>
<li><p>From the remote host</p>
<ul>
<li><code>docker load -i path_to_transferred_tar_file</code></li>
</ul>
</li>
</ol>
</li>
</ol>
</li>
</ol>
<p>Docker images are at the core of Docker's containerization technology, serving as the building blocks that enable the isolation and efficient deployment of applications.</p>
<p>In the next path, we'll expand our focus on the creation, lifecycle management, and interaction of another fundamental Docker object: the container. Containers provide a flexible and dynamic environment that encapsulates applications, their dependencies, and runtime configurations.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1692352819081/adca098a-ec63-435f-b4a0-3c19192c0e73.jpeg" alt class="image--center mx-auto" /></p>
]]></content:encoded></item></channel></rss>