<?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" xmlns:media="http://search.yahoo.com/mrss/" version="2.0">
    <channel>
        
        <title>
            <![CDATA[ container - freeCodeCamp.org ]]>
        </title>
        <description>
            <![CDATA[ Browse thousands of programming tutorials written by experts. Learn Web Development, Data Science, DevOps, Security, and get developer career advice. ]]>
        </description>
        <link>https://www.freecodecamp.org/news/</link>
        <image>
            <url>https://cdn.freecodecamp.org/universal/favicons/favicon.png</url>
            <title>
                <![CDATA[ container - freeCodeCamp.org ]]>
            </title>
            <link>https://www.freecodecamp.org/news/</link>
        </image>
        <generator>Eleventy</generator>
        <lastBuildDate>Thu, 14 May 2026 04:33:22 +0000</lastBuildDate>
        <atom:link href="https://www.freecodecamp.org/news/tag/container/rss.xml" rel="self" type="application/rss+xml" />
        <ttl>60</ttl>
        
            <item>
                <title>
                    <![CDATA[ How to Set Up Argo Workflows on Kubernetes ]]>
                </title>
                <description>
                    <![CDATA[ Argo Workflows is an open source project that enables the orchestration of multiple Kubernetes jobs. Argo Workflows is implemented as a Kubernetes custom resource definition (CRD), which means it is native to the Kubernetes ecosystem and can run on a... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/set-up-argo-workflows-on-kubernetes/</link>
                <guid isPermaLink="false">66d45d6051f567b42d9f8417</guid>
                
                    <category>
                        <![CDATA[ container ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Kubernetes ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Abraham Dahunsi ]]>
                </dc:creator>
                <pubDate>Thu, 15 Feb 2024 23:23:44 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2024/02/Feature-Image.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>Argo Workflows is an open source project that enables the orchestration of multiple Kubernetes jobs. Argo Workflows is implemented as a Kubernetes custom resource definition (CRD), which means it is native to the Kubernetes ecosystem and can run on any Kubernetes cluster.</p>
<p>Workflows are set steps by which individual jobs are executed. You can use Argo Workflows for various purposes, such as data processing, machine learning, CI/CD, and infrastructure automation.</p>
<p>In this article, you will set up Argo Workflows on a Kubernetes cluster and use available templates to create a Workflow to manage in a Kubernetes cluster.</p>
<h2 id="heading-argo-workflows-key-concepts">Argo Workflows Key Concepts</h2>
<p>As I mentioned above, Argo Workflows is implemented as a Kubernetes custom resource definition (CRD) by its own controller. Argo Workflows is made up of two main concepts: <code>workflow</code> and <code>Template</code>.</p>
<h3 id="heading-workflow">Workflow</h3>
<p>A workflow is a central resource in Argo Workflows that defines the workflow to be executed and stores the workflow’s state.</p>
<p>A workflow consists of a specification that contains an entrypoint and a list of templates.</p>
<p>A workflow can model complex logic using directed acyclic graphs (DAGs) or steps to capture the dependencies or sequences between the templates.</p>
<h3 id="heading-template">Template</h3>
<p>A template is a core concept in Argo Workflows that defines the instructions to execute in a workflow step. A template can be one of the following types:</p>
<ul>
<li><strong>Container</strong>: Allows you to be able to define the container. Here is an example:</li>
</ul>
<pre><code class="lang-YAML">  <span class="hljs-bullet">-</span> <span class="hljs-attr">name:</span> <span class="hljs-string">hello-world</span>
    <span class="hljs-attr">container:</span>
      <span class="hljs-attr">image:</span> <span class="hljs-string">alpine:latest</span>
      <span class="hljs-attr">command:</span> [<span class="hljs-string">sh</span>, <span class="hljs-string">-c</span>]
      <span class="hljs-attr">args:</span> [<span class="hljs-string">"echo hello world"</span>]
</code></pre>
<ul>
<li><strong>Script</strong>: A template that runs a script in a container image. This is similar to the container type, but allows you to write the script inline instead of using a separate file. Here is an example:</li>
</ul>
<pre><code class="lang-YAML">  <span class="hljs-bullet">-</span> <span class="hljs-attr">name:</span> <span class="hljs-string">factorial</span>
    <span class="hljs-attr">inputs:</span>
      <span class="hljs-attr">parameters:</span>
      <span class="hljs-bullet">-</span> <span class="hljs-attr">name:</span> <span class="hljs-string">num</span>
    <span class="hljs-attr">script:</span>
      <span class="hljs-attr">image:</span> <span class="hljs-string">python:alpine</span> <span class="hljs-number">3.6</span>
      <span class="hljs-attr">command:</span> [<span class="hljs-string">python</span>]
      <span class="hljs-attr">source:</span> <span class="hljs-string">|
        def factorial(n):
          if n == 0:
            return 1
          else:
            return n * factorial(n-1)
        print(factorial(int({{inputs.parameters.num}})))</span>
</code></pre>
<ul>
<li><strong>Resource</strong>: This template allows direct manipulation of cluster resources. It can be used for operations such as retrieval, creation, modification, or deletion, including GET, CREATE, APPLY, PATCH, REPLACE, or DELETE requests. Here is an example:</li>
</ul>
<pre><code class="lang-YAML">  <span class="hljs-bullet">-</span> <span class="hljs-attr">name:</span> <span class="hljs-string">create-configmap</span>
    <span class="hljs-attr">resource:</span>
      <span class="hljs-attr">action:</span> <span class="hljs-string">create</span>
      <span class="hljs-attr">manifest:</span> <span class="hljs-string">|
        apiVersion: v1
        kind: ConfigMap
        metadata:
          name: my-config
        data:
          foo: bar
          hello: world</span>
</code></pre>
<ul>
<li><strong>DAG</strong>: This template defines a directed acyclic graph of other templates. In this example, the DAG has three tasks: A, B, and C. Task A runs first, then tasks B and C run in parallel. Here is an example:</li>
</ul>
<pre><code class="lang-YAML">  <span class="hljs-bullet">-</span> <span class="hljs-attr">name:</span> <span class="hljs-string">my-dag</span>
    <span class="hljs-attr">dag:</span>
      <span class="hljs-attr">tasks:</span>
      <span class="hljs-bullet">-</span> <span class="hljs-attr">name:</span> <span class="hljs-string">A</span>
        <span class="hljs-attr">template:</span> <span class="hljs-string">echo</span>
        <span class="hljs-attr">arguments:</span>
          <span class="hljs-attr">parameters:</span> [{<span class="hljs-attr">name:</span> <span class="hljs-string">message</span>, <span class="hljs-attr">value:</span> <span class="hljs-string">A</span>}]
      <span class="hljs-bullet">-</span> <span class="hljs-attr">name:</span> <span class="hljs-string">B</span>
        <span class="hljs-attr">dependencies:</span> [<span class="hljs-string">A</span>]
        <span class="hljs-attr">template:</span> <span class="hljs-string">echo</span>
        <span class="hljs-attr">arguments:</span>
          <span class="hljs-attr">parameters:</span> [{<span class="hljs-attr">name:</span> <span class="hljs-string">message</span>, <span class="hljs-attr">value:</span> <span class="hljs-string">B</span>}]
      <span class="hljs-bullet">-</span> <span class="hljs-attr">name:</span> <span class="hljs-string">C</span>
        <span class="hljs-attr">dependencies:</span> [<span class="hljs-string">A</span>]
        <span class="hljs-attr">template:</span> <span class="hljs-string">echo</span>
        <span class="hljs-attr">arguments:</span>
          <span class="hljs-attr">parameters:</span> [{<span class="hljs-attr">name:</span> <span class="hljs-string">message</span>, <span class="hljs-attr">value:</span> <span class="hljs-string">C</span>}]
</code></pre>
<p>Now, let's get started.</p>
<h2 id="heading-prerequisites">Prerequisites</h2>
<p>To follow this guide, make sure you have the following:</p>
<ul>
<li><p>A Kubernetes cluster. To create a new Kubernetes cluster, follow this <a target="_blank" href="https://k21academy.com/docker-kubernetes/three-node-kubernetes-cluster/">guide</a></p>
</li>
<li><p>Basic knowledge of what Kubernetes is. <a target="_blank" href="https://kubernetes.io/docs/concepts/overview/">You can learn more about Kubernetes from their official docs</a></p>
</li>
<li><p><a target="_blank" href="https://kubernetes.io/docs/tasks/tools/">The Kubectl CLI</a></p>
</li>
</ul>
<h2 id="heading-step-1-install-argo-workflows">Step 1 - Install Argo Workflows</h2>
<ol>
<li>Using <code>Kubectl</code>, create a namespace for Argo Workflows to segregate your kubernetes cluster resources.</li>
</ol>
<pre><code class="lang-bash">$ kubectl create namespace argo
</code></pre>
<ol start="2">
<li>Install the latest Argo Workflows release file from <a target="_blank" href="https://github.com/argoproj/argo-workflows/releases">Argo Workflows github page</a>.</li>
</ol>
<pre><code class="lang-bash">$ kubectl apply -n argo -f https://github.com/argoproj/argo-workflows/releases/download/v&lt;VERSION&gt;/install.yaml
</code></pre>
<p>The version of Argo Workflows used in this guide is v3.5.0.</p>
<ol start="3">
<li>Check if all the resources have been installed correctly.</li>
</ol>
<pre><code class="lang-bash">$ kubectl get all -n argo
</code></pre>
<p>Output:</p>
<pre><code class="lang-bash">NAME                                      READY   STATUS    RESTARTS   AGE
pod/workflow-controller-7f8c9f8f5-9qj2l   1/1     Running   0          2m
pod/argo-server-6f8f9c9f8f-6kx4d          1/1     Running   0          2m

NAME                                  TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)    AGE
service/argo-server                   ClusterIP   10.3.240.123    &lt;none&gt;        2746/TCP   2m
service/workflow-controller-metrics   ClusterIP   10.3.240.124    &lt;none&gt;        9090/TCP   2m

NAME                                 READY   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/workflow-controller   1/1     1            1           3m05s
deployment.apps/argo-server           1/1     1            1           3m07s

NAME                                            DESIRED   CURRENT   READY   AGE
replicaset.apps/workflow-controller-7f8c9f8f5   1         1         1       3m33s
replicaset.apps/argo-server-6f8f9c9f8f          1         1         1       2m33s
</code></pre>
<h2 id="heading-step-2-start-the-argo-ui-for-monitoring">Step 2 - Start the Argo UI for Monitoring</h2>
<p>Argo Server has a graphical user interface that you can use to manage and monitor your Kubernetes cluster Workflows.</p>
<p>In this guide, you will bypass the authentication process of requesting a token to access the Argo web interface because it cannot be accessed publicly. This is called the <strong>Server Authentication</strong> mode, although you can use the other mode, <strong>Client Authentication</strong>, which requires that you request a token to be able to access the web interface.</p>
<ol>
<li>Change the authentication mode to Server Authentication.</li>
</ol>
<pre><code class="lang-bash">$ kubectl patch deployment \
  argo-server \
  --namespace argo \
  --<span class="hljs-built_in">type</span>=<span class="hljs-string">'json'</span> \
  -p=<span class="hljs-string">'[{"op": "replace", "path": "/spec/template/spec/containers/0/args", "value": [
  "server",
  "--auth-mode=server"
]}]'</span>
</code></pre>
<p>Output:</p>
<pre><code class="lang-bash">deployment.apps/argo-server patched
</code></pre>
<p>Note that this mode is not recommended for production environments, as it creates a significant security risks. A more secure option is to use the <strong>client authentication mode</strong>, which require clients to provide their Kubernetes bearer token.</p>
<ol start="2">
<li>Configure Kubernetes Role-Based Access Control (RBAC) to grant Argo Admin-level permissions for managing resources within the <code>argo</code> namespace.</li>
</ol>
<pre><code class="lang-bash">$ kubectl create rolebinding argo-default-admin --clusterrole=admin --serviceaccount=argo:default -n argo
</code></pre>
<ol start="3">
<li>Forward the Argo server web interface port with <code>kubectl port-forward</code>.</li>
</ol>
<pre><code class="lang-bash">$ kubectl -n argo port-forward deployment/argo-server 2746:2746
</code></pre>
<p>Using a browser like Chrome, visit the IP Address <code>http://localhost:2746</code>.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/02/Screenshot-20240213-003321.png" alt="Screenshot-20240213-003321" width="600" height="400" loading="lazy"></p>
<h2 id="heading-create-a-new-workflow">Create a New Workflow</h2>
<p>You can use a YAML manifest to define Agro Workflows and apply to your Kubernetes cluster.</p>
<ol>
<li>Create a new Workflow file.</li>
</ol>
<pre><code class="lang-bash">Nano argo-workflow.yaml
</code></pre>
<ol start="2">
<li>Add the following to the file:</li>
</ol>
<pre><code class="lang-YAML"><span class="hljs-attr">apiVersion:</span> <span class="hljs-string">argoproj.io/v1alpha1</span>
<span class="hljs-attr">kind:</span> <span class="hljs-string">Workflow</span>
<span class="hljs-attr">metadata:</span>
    <span class="hljs-attr">name:</span> <span class="hljs-string">demo-workflow</span>
<span class="hljs-attr">spec:</span>
    <span class="hljs-attr">entrypoint:</span> <span class="hljs-string">main</span>
    <span class="hljs-attr">templates:</span>
    <span class="hljs-bullet">-</span> <span class="hljs-attr">name:</span> <span class="hljs-string">main</span>
    <span class="hljs-attr">container:</span>
        <span class="hljs-attr">image:</span> <span class="hljs-string">busybox</span>
        <span class="hljs-attr">command:</span> [<span class="hljs-string">"/bin/sh"</span>]
        <span class="hljs-attr">args:</span> [<span class="hljs-string">"-c"</span>, <span class="hljs-string">"echo 'The first step of the Workflow'"</span>]
</code></pre>
<p>Here is a quick breakdown of the components of the file:</p>
<ul>
<li><p><code>entrypoint</code> specifies the entry point for the workflow, which is defined as <code>main</code>.</p>
</li>
<li><p><code>templates</code> contains a list of templates, which define the steps or tasks within the workflow.</p>
</li>
<li><p><code>name</code> is the name of the template, which is set as <code>main</code>.</p>
</li>
<li><p><code>container</code> specifies a container-based step within the workflow.</p>
</li>
<li><p><code>image</code> specifies the Docker image to use for the container, set here as <code>busybox</code>.</p>
</li>
<li><p><code>command</code> specifies the command to be executed inside the container, set as <code>["/bin/sh"]</code>.</p>
</li>
<li><p><code>args</code> specifies the arguments to be passed to the command inside the container, set as <code>["-c", "echo 'The first step of the Workflow'"]</code>. This command will run <code>echo</code> to print "The first step of the Workflow".</p>
</li>
</ul>
<ol start="3">
<li>Apply the Workflow to your cluster:</li>
</ol>
<pre><code class="lang-bash">$ kubectl -n argo create -f argo-workflow.yaml
</code></pre>
<p>Here's the output:</p>
<pre><code class="lang-bash">workflow.argoproj.io/hello-world-nb42c created
</code></pre>
<h2 id="heading-how-to-manage-argo-workflows">How to Manage Argo Workflows</h2>
<ol>
<li>To list all workflows within the <code>argo</code> namespace, do the following:</li>
</ol>
<pre><code class="lang-bash">$ kubectl -n argo get wf
</code></pre>
<p>Here's the output:</p>
<pre><code class="lang-bash">NAME                      STATUS        AGE     MESSAGE
demo-workflow             Succeeded     4m23s
</code></pre>
<ol start="2">
<li>To see the pod logs for your Workflow, do the following:</li>
</ol>
<pre><code class="lang-bash">$ kubectl -n argo logs demo-workflow
</code></pre>
<p>Here's the output:</p>
<pre><code class="lang-bash">This template is the first step of the Workflow
time=<span class="hljs-string">"2024-02-13T19:56:54.629Z"</span> level=info msg=<span class="hljs-string">"sub-process exited"</span> argo=<span class="hljs-literal">true</span> error=<span class="hljs-string">"&lt;nil&gt;"</span>
</code></pre>
<ol start="3">
<li>To delete a workflow, do this:</li>
</ol>
<pre><code class="lang-bash">$ kubectl -n argo delete wf workflow-name
</code></pre>
<ol start="4">
<li>To suspend or resume a workflow, do this:</li>
</ol>
<pre><code class="lang-bash">$ kubectl -n argo <span class="hljs-built_in">suspend</span> wf workflow-name
$ kubectl -n argo resume wf workflow-name
</code></pre>
<ol start="5">
<li>To submit a workflow using the Argo CLI, do this:</li>
</ol>
<pre><code class="lang-bash">$ argo submit -n argo workflow.yaml
</code></pre>
<p>You can learn more about Argo Workflows on their <a target="_blank" href="https://argo-workflows.readthedocs.io/en/latest/">official documentation.</a></p>
<h2 id="heading-conclusion">Conclusion</h2>
<p>You have now explored Argo Workflows and successfully set it up. This powerful tool enables you to create logic using DAGs, or individual steps, helping you execute various tasks through different templates. You can also interact with your workflows and keep track of their progress by utilizing tools like Argo CLI, Argo UI, and Argo Events.</p>
<p>By using Argo Workflows, you can take advantage of Kubernetes scalability and flexibility to ensure reliable execution of tasks.</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ How to Build and Push Dockerized Applications to the Azure Registry ]]>
                </title>
                <description>
                    <![CDATA[ A common issue on development teams is that an application might work on one developer’s computer but not on the others. Luckily, there's Docker, a popular containerization technology. It works by packing up all the components needed to run the appli... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/how-to-build-and-push-dockerized-applications-to-azure-registry/</link>
                <guid isPermaLink="false">66b906a6e8c4e204927a90f1</guid>
                
                    <category>
                        <![CDATA[ Azure ]]>
                    </category>
                
                    <category>
                        <![CDATA[ container ]]>
                    </category>
                
                    <category>
                        <![CDATA[ containerization ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Docker ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Destiny Erhabor ]]>
                </dc:creator>
                <pubDate>Wed, 29 Mar 2023 21:53:05 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2023/03/pexels-pixabay-163726--2-.jpg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>A common issue on development teams is that an application might work on one developer’s computer but not on the others.</p>
<p>Luckily, there's Docker, a popular containerization technology. It works by packing up all the components needed to run the application and then executing the application in an isolated environment. This helps tackle the problem of "it works on my machine but not yours."</p>
<p>You just have to save the application in the Docker registry so that it can be downloaded and used by other developers. In this article, you will learn how to build a web application Docker image and push it to an Azure private registry.</p>
<h2 id="heading-table-of-contents">Table of Contents</h2>
<ul>
<li><a class="post-section-overview" href="#heading-how-to-get-started">How to Get Started</a></li>
<li><a class="post-section-overview" href="#heading-how-to-build-a-docker-image">How to Build a Docker image</a></li>
<li><a class="post-section-overview" href="#how-to-run-and-test-a-new-container-locally-from-the-image">How to Run and Test a New Container Locally from the Image</a></li>
<li><a class="post-section-overview" href="#heading-how-to-push-the-image-to-azure-registry">How to Push the Image to Azure Registry</a></li>
<li><a class="post-section-overview" href="#heading-clean-up">Clean Up</a></li>
<li><a class="post-section-overview" href="#heading-summary">Summary</a></li>
</ul>
<h2 id="heading-how-to-get-started">How to Get Started</h2>
<p>Before attempting to follow along with this tutorial, you should have the following:</p>
<ul>
<li>Docker installed – You can install Docker from the <a target="_blank" href="https://www.docker.com/community-edition">Docker website</a>.</li>
<li>An Azure Subscription – You can <a target="_blank" href="https://azure.microsoft.com/en-us/free/?WT.mc_id=academic-75638-bethanycheum">sign up</a> for a free Azure account if you don’t already have one.</li>
<li><a target="_blank" href="https://learn.microsoft.com/en-us/cli/azure/install-azure-cli">Azure CLI</a> – This tutorial requires the Azure command-line interface (CLI) to interact with the Azure container registry.</li>
<li>Basic understanding of Docker commands and containers.</li>
</ul>
<h2 id="heading-how-to-build-a-docker-image">How to Build a Docker Image</h2>
<p>A Docker image is a fundamental component and consists of a text file called a <strong>Dockerfile</strong>. This contains the application files and binaries that you wish to containerize.</p>
<p>In this guide, you will examine an example that lets you create a Docker image that has an Apache web server and a web application in order to learn how to create a Docker image.</p>
<h3 id="heading-how-to-create-a-docker-image-from-a-dockerfile">How to Create a Docker image from a Dockerfile</h3>
<p>You will first develop an HTML page that serves as your web application before writing a Dockerfile. As a result, you will create a new directory called <code>appdocker</code> and within it, create a new file called “index.html”. Add the following code to index.html:</p>
<pre><code class="lang-html"><span class="hljs-tag">&lt;<span class="hljs-name">html</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">body</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">h1</span>&gt;</span>Welcome to my web app<span class="hljs-tag">&lt;/<span class="hljs-name">h1</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">p</span>&gt;</span>This page demo how to create, build and push a dockerized application to azure container registrar, (ACR) <span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span>

    <span class="hljs-tag">&lt;/<span class="hljs-name">body</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">html</span>&gt;</span>
</code></pre>
<p>You should now create a Dockerfile (without an extension) in the same directory with the content listed below to build your web image, which we will cover in more detail next.</p>
<pre><code class="lang-docker"><span class="hljs-keyword">FROM</span> httpd:latest
<span class="hljs-keyword">LABEL</span><span class="bash"> Owner <span class="hljs-string">'Destiny Erhabor'</span></span>
<span class="hljs-keyword">COPY</span><span class="bash"> index.html /usr/<span class="hljs-built_in">local</span>/apache2/htdocs/</span>
</code></pre>
<ul>
<li>Every Docker image is created from another Docker image. The <code>FROM httpd:latest</code> at the start of the Dockerfile is necessary and indicates the Apache base image you will use for your own.</li>
<li>The <code>LABEL Owner 'Destiny Erhabor'</code> gives you an option to specify the image owner. In this case you should use your name.</li>
<li>The image creation procedure is then carried out using the <code>COPY index.html /etc/nginx/nginx.conf</code> instruction. The local index.html page that you created is copied by Docker into the image's /usr/local/apache2/htdocs/ directory.</li>
</ul>
<p>Now, to build the Docker image, open a terminal to where the Dockerfile is located in the folder “appdocker”, and then run the docker build command:</p>
<pre><code>docker build -t mywebapp:v1 .
</code></pre><p><img alt="docker build" width="600" height="400" loading="lazy">
<em>docker build</em></p>
<p>You can also check list of the images created by executing the command:</p>
<pre><code>docker images
</code></pre><p><img alt="docker images" width="600" height="400" loading="lazy">
<em>docker images</em></p>
<p>The three steps of the Docker image builder are as follows, which you can see in the execution above:</p>
<ol>
<li>The base image is downloaded by Docker in step one.</li>
<li>Docker copies the image's index.html file.</li>
<li>The image is created and tagged by Docker.</li>
</ol>
<h2 id="heading-how-to-run-and-test-a-new-container-locally-from-the-image">How to Run and Test a New Container Locally from the Image.</h2>
<p>You will use the <code>docker run</code> command in your terminal to create a new container using your Docker image as follows:</p>
<pre><code>docker run -d --name mywebapp -p <span class="hljs-number">8080</span>:<span class="hljs-number">80</span> mywebapp:v1
</code></pre><ul>
<li>The name of the container you desire is specified in the <code>--name</code> parameter. </li>
<li>You define the desired port translation with the <code>-p</code> argument. In your example, this would entail that our local machine's port 8080 would be translated from port 80 of the container. </li>
<li>The name of the image and its tag make up the command's final parameter.</li>
</ul>
<p>You can test your container on your local system on the port translation that we previously performed. To achieve this, launch a browser and type <a target="_blank" href="http://localhost:8080/">http://localhost:8080</a>.</p>
<p><img alt="testing image locally" width="600" height="400" loading="lazy">
<em>testing image locally</em></p>
<h2 id="heading-how-to-push-the-image-to-azure-registry">How to Push the Image to Azure Registry</h2>
<p>The primary repository for shared Docker images is called the Docker Registry. This registry can either be public, such as Docker Hub or private, such as Azure Container Registry.</p>
<p>Private Docker container images and other relevant artifacts can be stored and managed on the Microsoft-owned Azure Container Registry (ACR). These images can then be downloaded and used for local or hosting platform container-based deployments.</p>
<p>You'll need to go through the following steps to push your image into ACR:</p>
<p>First, you will launch the azure CLI command below in your terminal to connect to your Azure account:</p>
<pre><code>az login
</code></pre><p>Next, you’ll use the Azure CLI to create a resource group, a container that manages multiple Azure resources using <code>az group create</code> and the azure container registry using the <code>az acr</code> commands:</p>
<pre><code>az group create --name RG-ACR --location eastus
</code></pre><p>The <code>--name</code> tag specifies the resource group name as <code>RG-ACR</code> and <code>--location</code> gives the region where it is located as <code>eastus</code>.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/03/resource-group-az.png" alt="Image" width="600" height="400" loading="lazy">
<em>Resource group</em></p>
<pre><code>az acr create --resource-group RG-ACR --name mywebappacrdemo --sku Basic
</code></pre><p>The resource group you created earlier is required to manage the acr resource – hence the <code>--resource-group</code> tag. The <code>--name</code> specifies the name of the registry (the name must be <strong>globally unique</strong>) and the <code>--sku</code> provides the several service tiers. </p>
<p>These tiers offer a range of options for the capacity and use of your private Docker registry together with predictable pricing. Here you are using Basic tiers.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/03/azure-acr.png" alt="Image" width="600" height="400" loading="lazy">
<em>ACR resources creation</em></p>
<p>Now that you are logged in, use the command to establish a connection to the ACR resource you created above by passing the <code>--name</code> parameter as the name of that resource:</p>
<pre><code>az acr login --name mywebappacrdemo
</code></pre><p>When the command is successful, a Login Succeeded message is returned.</p>
<p>Finally, run a few instructions to push the mywebapp Docker image into your ACR resource.</p>
<p>The initial action is to tag the image with the fully qualified name of the login server for the registry. The format of the fully qualified name is . azurecr.io, as show below:</p>
<pre><code>docker tag mywebapp:v1 mywebappacrdemo.azurecr.io/mywebapp:v1
</code></pre><p>Now push the image into the ACR resource.</p>
<pre><code>docker push mywebappacrdemo.azurecr.io/mywebapp:v1
</code></pre><p><img alt="Image" width="600" height="400" loading="lazy">
<em>ACR resource in azure portal</em></p>
<h2 id="heading-clean-up"><strong>Clean Up</strong></h2>
<p>To avoid paying for the underlying Azure cost, you should clean up your resources if they're not being used.</p>
<p>To clean up your Azure resources, in the Azure portal go to or search for resources group, find the one you just created, and delete it. This will delete all resources in the resource group.</p>
<h2 id="heading-summary">Summary</h2>
<p>In this tutorial, we looked at the primary tasks that go into building and running a Docker image for a web application.</p>
<p>You also learned how to push a Docker image to the Azure container registry using the Azure CLI.</p>
<p>As always, I hope you enjoyed the article and learned something new. If you want, you can follow me on <a target="_blank" href="https://www.linkedin.com/in/destiny-erhabor">LinkedIn</a> or <a target="_blank" href="https://twitter.com/caesar_sage">Twitter</a>.</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ How to Get Started with Docker using NodeJS ]]>
                </title>
                <description>
                    <![CDATA[ You might have seen a tool with the logo of a whale lifting some square containers. Yes, I am talking about Docker.  The Docker logo actually symbolizes software that brings together a huge amount of organized information, hinting at its convenience.... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/how-to-get-started-with-docker-using-nodejs/</link>
                <guid isPermaLink="false">66ba10c1256f04965e2bd0de</guid>
                
                    <category>
                        <![CDATA[ container ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Docker ]]>
                    </category>
                
                    <category>
                        <![CDATA[ node ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Arunachalam B ]]>
                </dc:creator>
                <pubDate>Mon, 20 Mar 2023 14:28:45 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2023/03/How-to-get-started-with-Docker-using-NodeJS.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>You might have seen a tool with the logo of a whale lifting some square containers. Yes, I am talking about Docker. </p>
<p>The Docker logo actually symbolizes software that brings together a huge amount of organized information, hinting at its convenience.</p>
<p>Many enterprise applications use Docker-based deployments (also called containerized deployments) these days. So it's a good skill to have as a developer.</p>
<p>This tutorial will be the best fit for those who know nothing apart from the term "Docker".</p>
<p>In this article, you'll learn about the fundamentals of Docker, build your own Docker image, and publish it to the Docker Hub.</p>
<h2 id="heading-why-do-you-need-docker">Why Do You Need Docker?</h2>
<p>Let's understand why we need Docker with a simple example.</p>
<p>Let's assume you're joining a new company and you have been assigned to an extremely huge project to work on. You received a brand new laptop and are ready to put on your development shoes. </p>
<p>The first step whenever you are onboarded into a project is to set up the development environment. Since it's a huge enterprise project, it consumes a bunch of time to set up the development environment. You may need to install project-specific dependencies, tools, and many more. </p>
<p>In the middle, you may face errors that you can mostly solve by following the README guide, but a couple of them might happen for the first time (might happen due to laptop configuration) and you have to solve them on your own.</p>
<p>Imagine if you have to follow the same process for large teams with tons of members. It would be horrible to handle right?</p>
<p>This is where Docker comes in really handy. Docker will create containerized applications that run on any type of environment that have all the dependencies within it. So setting up the development environment is just one command away. Docker has many use cases – this scenario is just one of them.</p>
<p>By using Docker we can standardize application operations, ship code faster, and seamlessly deploy to production.</p>
<h2 id="heading-how-does-docker-work">How Does Docker Work?</h2>
<p>Docker provides a standardized way to develop, test, and deploy code.</p>
<p>You can think about Docker as a super-powered advanced virtual machine. Let’s learn more about it with an example.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/03/image-171.png" alt="Image" width="600" height="400" loading="lazy">
<em>Comparison between Virtual Machine and Docker</em></p>
<p>Before getting started to work on Docker, we should understand some fundamentals of how it works. They are:</p>
<ol>
<li>Docker Engine</li>
<li>Docker Container</li>
<li>Docker Image</li>
</ol>
<h3 id="heading-what-is-docker-engine">What is Docker Engine?</h3>
<p>The Docker engine is an open-source containerization technology you can use to build a containerizing application. W</p>
<p>e can use the Docker engine on a variety of platforms through Docker Desktop or Binary Installation. To simplify, the software that hosts the containers is called Docker Engine.</p>
<h3 id="heading-what-is-a-docker-container">What is a Docker Container?</h3>
<p>A container is a standard unit of software that packages up the code and all required dependencies needed to run an application on different platforms or computing environments.</p>
<p>Containers are fully isolated from the computing environment, so applications run quickly and reliably from one computing environment to another.</p>
<p>Docker containers are built from container images.</p>
<h3 id="heading-what-is-a-docker-image">What is a Docker image?</h3>
<p>A Docker container image is a lightweight, standalone, executable package of software that includes everything needed to run an application. It includes code, runtime, system tools, system libraries, and settings.</p>
<p>As we discussed, containers are built from images. Images become containers when they starts running on a Docker Engine.</p>
<h3 id="heading-use-cases-for-docker">Use Cases for Docker</h3>
<p>Docker gives you the ability to run an application in any type of environment which is completely isolated from the current environment. This isolated environment is called a container. </p>
<p>This isolation and security allow us to run as many containers as we want in a host. Docker helps developers to work in a standardized environment using local containers which provide all the packages and dependencies to run an application.</p>
<p>Let's see a few use cases of Docker:</p>
<ol>
<li>Developers can write code locally and share their work using Docker containers</li>
<li>You can use Docker to deploy your applications into a test/production environment and execute automated and manual tests</li>
<li>When developers need to fix something, they can easily make the changes and push the Docker image to the testing or production environment</li>
</ol>
<p>Just like Git, we can use Docker when we're making changes to our projects. If we make any changes we can just push the Docker images and pull them into the host machine. No more changes need to be done in the host server.</p>
<p>Here are the deployment steps you'd go through if you're not using Docker:</p>
<ol>
<li>Pull/clone the code from Git</li>
<li>Install dependencies, run migrations, and so on in the host machine.</li>
<li>Start the application</li>
</ol>
<p>These steps have to be repeated on every server whether it is a testing or production environment.</p>
<p>Here is the deployment steps using Docker:</p>
<ol>
<li>Pull the docker image (<code>docker pull</code>)</li>
<li>Run the container in the host machine (<code>docker run</code>)</li>
</ol>
<h3 id="heading-what-is-docker-hub">What is Docker Hub?</h3>
<p>Docker Hub is the largest community for Docker images. It allows you to share the container images among your team, or the Docker community. Docker Hub is sort of like GitHub. Here, Docker images reside instead of the project's code.</p>
<p>You can pull the open-source Docker images also. To use this you have to create an account in Docker <a target="_blank" href="https://hub.docker.com">hub</a>.</p>
<p>Now that you know a bit about how Docker works and why it's useful, let's learn how to containerize an application.</p>
<h2 id="heading-how-to-containerize-a-nodejs-application-using-docker"><strong>How to Containerize a NodeJS Application using Docker</strong></h2>
<h3 id="heading-prerequisites">Prerequisites:</h3>
<ol>
<li>A Basic understanding of NodeJS Applications</li>
<li>Docker desktop application</li>
</ol>
<p>You can install the Docker Desktop application by following their original <a target="_blank" href="https://docs.docker.com/desktop/install/windows-install/">documentation</a>.</p>
<p>You can verify if Docker is installed on your machine by querying it's version like this:</p>
<pre><code class="lang-bash">docker -v
</code></pre>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/03/image-172.png" alt="Image" width="600" height="400" loading="lazy">
<em>Find Docker Version</em></p>
<p>Let's start our implementation.</p>
<p>Instead of starting over from scratch, I have created a super simple Express API that exposes only one endpoint. I pushed the code to a public repo on GitHub. You can clone the repo by running the below command:</p>
<pre><code class="lang-bash">git <span class="hljs-built_in">clone</span> https://github.com/5minslearn/node_with_docker.git
</code></pre>
<p>This is the project's structure:</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/03/image-168.png" alt="Image" width="600" height="400" loading="lazy">
<em>Simple NodeJS Project Structure</em></p>
<p>I have created only one endpoint ("/") and calling it will return "Greeting from 5minslearn". I've simplified this as much as possible to allow us to focus more on Docker.</p>
<h2 id="heading-how-to-create-a-dockerfile">How to Create a Dockerfile</h2>
<p>Now, you'll need to create a file named "Dockerfile" in the root directory. It is the default file name for the Docker engine. Paste the following code into the file:</p>
<pre><code class="lang-dockerfile"><span class="hljs-keyword">FROM</span> node:latest
<span class="hljs-keyword">WORKDIR</span><span class="bash"> /app</span>
<span class="hljs-keyword">COPY</span><span class="bash"> . /app</span>
<span class="hljs-keyword">RUN</span><span class="bash"> npm install</span>
<span class="hljs-keyword">EXPOSE</span> <span class="hljs-number">8000</span>
<span class="hljs-keyword">CMD</span><span class="bash"> [<span class="hljs-string">"npm"</span>,<span class="hljs-string">"start"</span>]</span>
</code></pre>
<p>Let's understand these commands line by line.</p>
<p>Defining the parent image is the first step of Docker engine. You have to define the parent image from which you're building the project. In our case it's Node. </p>
<p>There are a lot of parent images available in Docker Hub. You have to define the Image Variant next to the parent image. I always prefer to use the latest node image.</p>
<pre><code class="lang-dockerfile"><span class="hljs-keyword">FROM</span> node:latest
</code></pre>
<p>The second step is to define the working directory in Docker. Let's define our working directory as the <code>app</code> directory.</p>
<pre><code class="lang-dockerfile"><span class="hljs-keyword">WORKDIR</span><span class="bash"> /app</span>
</code></pre>
<p>Copy the project to the <code>app</code> directory. Make sure you exclude the <code>node_modules</code> directory. We will see how to ignore files/folders in the upcoming steps.</p>
<pre><code class="lang-dockerfile"><span class="hljs-keyword">COPY</span><span class="bash"> . /app</span>
</code></pre>
<p>In the above command, the <code>.</code> indicates that all the files and directories are to be copied to the <code>app</code> folder.</p>
<p>The next step is to install the required dependencies with this command:</p>
<pre><code class="lang-dockerfile"><span class="hljs-keyword">RUN</span><span class="bash"> npm install</span>
</code></pre>
<p>RUN is an image build step. The state of the container after a RUN command will be committed to the container image. A Dockerfile can have many RUN steps that can layer on top of one another to build the image.</p>
<p>Expose the port in which application should run.</p>
<pre><code class="lang-dockerfile"><span class="hljs-keyword">EXPOSE</span> <span class="hljs-number">8000</span>
</code></pre>
<p>The EXPOSE instruction informs Docker that the container listens on the specified network ports at runtime.</p>
<p>Finally run the execution command:</p>
<pre><code class="lang-dockerfile"><span class="hljs-keyword">CMD</span><span class="bash"> ts-node src/index.ts</span>
</code></pre>
<p>CMD is the command the container executes by default when we launch the built image.</p>
<p><strong>Tip:</strong> I recommend that you install the <code>Docker</code> extension if you're using VS Code. It'll help you with its solid suggestions.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/03/image-174.png" alt="Image" width="600" height="400" loading="lazy">
<em>VS Code <code>Docker</code> extension</em></p>
<h2 id="heading-how-to-ignore-files-so-theyre-not-copied-into-the-docker-container">How to Ignore Files So They're Not Copied into the Docker Container</h2>
<p>You have to exclude the unwanted files from being copied into the container. The <code>.dockerignore</code> file helps you with that. It works like <code>.gitignore</code> for Git.</p>
<p>You can define all the files you have to ignore and don't want to copy.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/03/image-169.png" alt="Image" width="600" height="400" loading="lazy">
<em>Using <code>.dockerignore</code> to exclude the unwanted files from being copied to the container</em></p>
<p>Great! You've completed the Docker configuration. Let's run the application.</p>
<h2 id="heading-how-to-build-docker-images">How to Build Docker Images</h2>
<p>You can build a Docker image by running the <code>docker build</code> command. Here's the syntax for it:</p>
<pre><code class="lang-bash">docker build -t image_name:version_number .
</code></pre>
<p><code>image_name</code> indicates the container image name and <code>version_number</code> indicates the image version. Did you notice the dot (<code>.</code>) at the end of the command? It indicates that the Docker image should be built from the current directory.</p>
<p>I decided to set the image name as <code>node_with_docker</code>. Remember that the image name has to be prefixed with the Docker hub username. I've created my Docker hub account with the <code>aanandggs</code> username. So, my image name is <code>aanandggs/node_with_docker</code>. You may choose to enter whatever you want. </p>
<pre><code class="lang-bash">docker build -t aanandggs/node_with_docker:0.0.1 .
</code></pre>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/03/image-175.png" alt="Image" width="600" height="400" loading="lazy">
<em>Sample output of building docker image</em></p>
<p>Once you've built your Docker image, you'll be able to see it on your Docker Desktop.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/03/image-178.png" alt="Image" width="600" height="400" loading="lazy">
<em>Docker Image in Docker Desktop</em></p>
<h2 id="heading-how-to-run-the-docker-image">How to Run the Docker Image</h2>
<p>After we build the Docker image, the next step is to run it. When an image starts running on a Docker Engine, it'll become a container.</p>
<p>Let's run our image which we built in the previous step:</p>
<pre><code class="lang-bash">docker container run -d --name &lt;name_of_app&gt; -p &lt;local_port&gt;:&lt;docker_port&gt; &lt;image_name&gt;:&lt;version&gt;
</code></pre>
<pre><code class="lang-bash">docker container run -d --name docker_with_node -p 8000:8000 aanandggs/node_with_docker:0.0.1
</code></pre>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/03/image-179.png" alt="Image" width="600" height="400" loading="lazy">
<em>Docker Command to create and run a container</em></p>
<p>Let's understand the above command.</p>
<p>We use the <code>docker container run</code> command to create and run a new container from an image.</p>
<p>The <code>-d</code> flag instructs the container to run in the background (detach). It prints the container id.</p>
<p>The <code>--name</code> parameter gives a name to our container.</p>
<p>We use the <code>-p</code> parameter to publish a container’s port to the host. It'll bind the port <code>8000</code> of your local machine with the port <code>8000</code> of the Docker container.</p>
<p><code>image_name:version</code> indicates the image and its version that this container should run.</p>
<p>You can have a look at the running containers in the Docker Desktop app.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/03/image-180.png" alt="Image" width="600" height="400" loading="lazy">
<em>Running Container in Docker Desktop</em></p>
<p>The Dashboard shows that our app is running. Let's check the output on the browser by trying to access the "/" endpoint. Hit <code>locahost:8000/</code> on your browser. You should see a message similar to the one in the below screenshot:</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/03/image-181.png" alt="Image" width="600" height="400" loading="lazy">
<em>NodeJS App running output</em></p>
<p>You have successfully run an app with a Docker container.</p>
<p><strong>Note:</strong> You can bind any local port to the Docker port. Ensure your local port is not used by any other process.</p>
<h2 id="heading-how-to-push-the-image-to-the-docker-hub">How to Push the Image to the Docker Hub</h2>
<p>Create your profile on Docker Hub. Come back to terminal and run the below command to login to Docker CLI:</p>
<pre><code class="lang-bash">docker login
</code></pre>
<p>If you face any issues with login, follow this <a target="_blank" href="https://docs.docker.com/desktop/get-started/#credentials-management-for-linux-users">doc</a> to login to the Dockerhub on your machine.</p>
<p>After a successful login, you can push the image to Docker hub.</p>
<pre><code class="lang-bash">docker push &lt;docker_image&gt;:&lt;image_version&gt;
</code></pre>
<pre><code class="lang-bash">docker push aanandggs/node_with_docker:0.0.1
</code></pre>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/03/image-182.png" alt="Image" width="600" height="400" loading="lazy">
<em>Sample output of pushing image to docker</em></p>
<p>Hurray! Docker images are uploaded to Docker hub.</p>
<p>You'll be able to see them in the Docker hub console.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/03/image-184.png" alt="Image" width="600" height="400" loading="lazy">
<em>Pushed Docker image in DockerHub</em></p>
<p>Since our image is public, anyone on the internet can pull the image and run it on their machines without any third-party installation.</p>
<h2 id="heading-conclusion">Conclusion</h2>
<p>In this article, we have learnt the very basics of Docker. Docker is an ocean of information. To fully learn it, you'll need to do more than just reading – you'll need to practice working with it.</p>
<p>Hope you folks enjoyed reading this one. Will see you in another interesting tutorial. Feel free to reach out to me on LinkedIn if you have any queries. </p>
<p>To learn more about Docker, subscribe to my email newsletter on my <a target="_blank" href="https://5minslearn.gogosoon.com/?ref=fcc_docker_getting_started">site</a> (<a target="_blank" href="https://5minslearn.gogosoon.com/?ref=fcc_docker_getting_started">https://5minslearn.gogosoon.com</a>) and follow me on social media. </p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ Docker vs Virtual Machine (VM) – Key Differences You Should Know ]]>
                </title>
                <description>
                    <![CDATA[ In this guide, you'll learn the differences between a virtual machine and a Docker container. Both virtual machines and containers help replicate the development environment, and manage dependencies and configurations better. But there are certain di... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/docker-vs-vm-key-differences-you-should-know/</link>
                <guid isPermaLink="false">66bb8b26c332a9c775d15b68</guid>
                
                    <category>
                        <![CDATA[ container ]]>
                    </category>
                
                    <category>
                        <![CDATA[ containerization ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Docker ]]>
                    </category>
                
                    <category>
                        <![CDATA[ virtual machine ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Bala Priya C ]]>
                </dc:creator>
                <pubDate>Tue, 04 Oct 2022 16:48:57 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2022/07/docker-vs-vm-diff.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>In this guide, you'll learn the differences between a <strong>virtual machine</strong> and a <strong>Docker</strong> container.</p>
<p>Both virtual machines and containers help replicate the development environment, and manage dependencies and configurations better. But there are certain differences you should be aware of that will help you choose a VM or a Docker container depending on the application.</p>
<p>Over the next few minutes, we'll go over how virtual machines and Docker containers work, and then summarize the key differences between the two.</p>
<p>Let's begin!</p>
<h2 id="heading-challenges-in-application-development-and-deployment">Challenges in Application Development and Deployment</h2>
<p>When you work as part of a development team, each application requires installation of multiple third-party software and packages. In order to collaborate and work together, every developer on the team should configure their local development environment.</p>
<p>However, setting up the development environment is a tedious process. The installation steps can be potentially different depending on the operating system and system configuration. Even during deployment, you have to configure the same environment on the server.</p>
<p>Different applications also require multiple versions of a specific software, say, PostgreSQL. In such cases, managing dependencies across applications becomes difficult.</p>
<p>To address the above challenges, it really helps if the applications run in isolated environments that you can replicate easily—independent of the system configuration. Both Virtual Machines (VMs) and Docker containers help you achieve this. Let's learn how!</p>
<h2 id="heading-how-does-a-virtual-machine-work">How Does a Virtual Machine Work?</h2>
<p>A <strong>Virtual Machine</strong> or <strong>VM</strong> is the emulation of a physical computer inside a host machine. </p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/10/1.png" alt="Image" width="600" height="400" loading="lazy">
<em>How a VM works (image by the author)</em></p>
<p>Running on top of the host operating system is a piece of software called a hypervisor that controls the VM instances. Each VM instance has its own guest operating system. The applications run inside this isolated environment. </p>
<p>You can have multiple VMs, each running a different application on a different operating system.</p>
<h2 id="heading-how-does-a-docker-container-work">How Does a Docker Container Work?</h2>
<p>Recently, container technology has revolutionized the software development process and the way development and operation teams work together. With time, Docker has become the go-to choice for containerizing applications.</p>
<p>Dockers containers are analogous to physical containers that you can use to store, package, and transport goods. But instead of tangible goods, they’re containers for software applications. 🙂</p>
<p>A docker container is a portable unit of software—that has the application—along with the associated dependency and configuration. </p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/10/2.png" alt="Image" width="600" height="400" loading="lazy">
<em>How containers work (image by the author)</em></p>
<p>Unlike a VM, Docker containers <em>do not</em> boot up their own guest OS. Rather, they run on top of the host operating system. This is facilitated by a container engine.</p>
<h2 id="heading-docker-vs-vm-a-comprehensive-comparison">Docker vs VM – A Comprehensive Comparison</h2>
<h3 id="heading-1-virtualization">1️⃣ Virtualization</h3>
<p>From our understanding thus far, both virtual machines and Docker containers provide isolated environments to run applications. The key difference between the two is in <em>how</em> they facilitate this isolation.</p>
<p>Recall that a VM boots up its own guest OS. Therefore, it virtualizes both the operating system kernel and the application layer. </p>
<p>A Docker container virtualizes <em>only</em> the application layer, and runs on top of the host operating system.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/10/3.png" alt="Image" width="600" height="400" loading="lazy">
<em>Container vs VM (image by the author)</em></p>
<h3 id="heading-2-compatibility">2️⃣ Compatibility</h3>
<p>A virtual machine uses its own operating system and is <em>independent</em> of the host operating system that it’s running on.  Therefore, a VM is compatible with all operating systems. </p>
<p>A Docker container, on the other hand, is compatible with <em>any</em> Linux distribution. You may run into some problems running Docker on a Windows machine or an older Mac.</p>
<h3 id="heading-3-size">3️⃣ Size</h3>
<p>A Docker image is lightweight and is typically in the order of kilobytes. </p>
<p><strong>💡 Note</strong>: A Docker image denotes the artifact containing the application, its associated dependencies, and configuration. A running instance of the Docker image is called a container.</p>
<p>A VM instance can be as large as a few gigabytes or even terabytes.</p>
<h3 id="heading-4-performance">4️⃣ Performance</h3>
<p>In terms of performance, Docker containers provide near-native performance. Because they are lightweight, you can start them in a few milliseconds. </p>
<p>Starting a VM is equivalent to setting up a standalone machine inside your computer. It can take as long as a few minutes to start a VM instance.</p>
<h3 id="heading-5-security">5️⃣ Security</h3>
<p>Docker containers run on top of the host operating system. Therefore, if the host OS is susceptible to security vulnerabilities, so are the Docker containers.</p>
<p>Virtual machines, on the other hand, boot up their own operating system, and are more secure. Recall: each virtual machine is a fully blown machine running inside another. If you have stringent security constraints to be met for sensitive applications, you should consider using a virtual machine instead.</p>
<h3 id="heading-6-replicability">6️⃣ Replicability</h3>
<p>The next factor we'll consider is the ease with which you can replicate the isolated environments provided by VMs and containers. We can infer the ease of replicability from our earlier discussions on <strong>size</strong> and <strong>performance</strong>. </p>
<p>When there are multiple applications, each of which should run on a VM instance, using VMs can be <strong>inefficient</strong> and <strong>resource intensive</strong>. Docker containers, by virtue of being lightweight and performant, are preferred when you need to run multiple applications. ✅</p>
<h2 id="heading-summing-up">Summing Up</h2>
<p>I hope this tutorial helped you understand how Docker containers and VMs work, and the key differences between the two. </p>
<p>Here's a summary of what you've learned:</p>
<div class="hn-table">
<table>
<thead>
<tr>
<td>Feature</td><td>Docker</td><td>Virtual Machine (VM)</td></tr>
</thead>
<tbody>
<tr>
<td>Compatibility</td><td>Works best with Linux distributions</td><td>All operating systems</td></tr>
<tr>
<td>Size</td><td>Light in weight</td><td>Substantially larger – of the order of Gigabytes or more</td></tr>
<tr>
<td>Virtualization</td><td>Only the applications layer</td><td>Both the OS kernel and applications layers</td></tr>
<tr>
<td>Performance</td><td>Easy to start containers (typically takes milliseconds)</td><td>Takes longer to start a VM instance</td></tr>
<tr>
<td>Security</td><td>Less secure</td><td>Relatively more secure</td></tr>
<tr>
<td>Replicability</td><td>Easy to replicate. You can pull Docker images corresponding to the various applications</td><td>Difficult to replicate, especially with increasing number of VM instances</td></tr>
</tbody>
</table>
</div><p>Thank you for reading this far. See you all soon in another tutorial! 😄</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ How to Make Your Enterprise Kubernetes Environment Secure, Efficient, and Reliable ]]>
                </title>
                <description>
                    <![CDATA[ By Andrej Kovacevic If you’re a cloud-based entrepreneur, you should have a Kubernetes platform for your enterprise. But adopting this six-year-old technology can be tough if there are gaps in your operations. Improving the operational quality of you... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/make-your-kubernetes-environment-secure-efficient-reliable/</link>
                <guid isPermaLink="false">66d45db09f2bec37e2da0612</guid>
                
                    <category>
                        <![CDATA[ Application Security ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Cloud Computing ]]>
                    </category>
                
                    <category>
                        <![CDATA[ container ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Kubernetes ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ freeCodeCamp ]]>
                </dc:creator>
                <pubDate>Thu, 09 Sep 2021 16:36:35 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2021/09/kubernetes-article-image.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>By Andrej Kovacevic</p>
<p>If you’re a cloud-based entrepreneur, you should have a Kubernetes platform for your enterprise. But adopting this <a target="_blank" href="https://blog.risingstack.com/the-history-of-kubernetes/">six-year-old technology</a> can be tough if there are gaps in your operations.</p>
<p>Improving the operational quality of your Kubernetes cluster is important in Kubernetes adoption. This article can help you achieve a secure, efficient, and reliable Kubernetes environment.</p>
<p>But first, you must understand what Kubernetes is. Read on to get important tips for your Kubernetes journey.</p>
<h2 id="heading-what-is-kubernetes">What is Kubernetes?</h2>
<p>Kubernetes is an extensible, open-source platform built to manage containerized workloads and services. Google designed the technology, and the Cloud Native Computing Foundation maintains it.</p>
<p>Some of the features of the platform include:</p>
<ul>
<li>Storage orchestration</li>
<li>Service discovery and load balancing</li>
<li>Electronic rollouts and rollbacks</li>
<li>Automatic bin packing</li>
<li>Secret and configuration management</li>
</ul>
<p>Don Foster, VP at Commvault, highlighted the importance of Kubernetes in digitalization. He outlined the value of containers to modern firms in an <a target="_blank" href="https://tdwi.org/articles/2021/01/04/ta-all-containers-and-kubernetes-accelerating-digital-transformation-in-2021.aspx">Executive Q&amp;A session with TDWI</a>. </p>
<p>According to Foster, containers introduce applications that can deploy new digital services. DevOps can work on apps without worrying whether they'll work in other environments.</p>
<p>He added that containers also speed up companies' digital transformation efforts.</p>
<p>To promote the use of the platform, Fairwinds developed the <a target="_blank" href="https://www.fairwinds.com/blog/introducing-the-kubernetes-maturity-model">Kubernetes Maturity Model</a>. Fairwinds is a Kubernetes enablement company.</p>
<h3 id="heading-what-is-the-kubernetes-maturity-model">What is the Kubernetes Maturity Model?</h3>
<p>This model determines what stage you are in along your journey towards becoming cloud-native. It has seven phases:</p>
<ul>
<li>(Phase 1) Preparation</li>
<li>(Phase 2) Transformation</li>
<li>(Phase 3) Deployment</li>
<li>(Phase 4) Confidence Building</li>
<li>(Phase 5) Operational Improvement</li>
<li>(Phase 6) Measurement and Control</li>
<li>(Phase 7) Optimization and Automation</li>
</ul>
<p>All these phases are important in Kubernetes adoption. But, you must pay special attention to possible issues during the fifth phase. </p>
<p>During this operation improvement phase, you may struggle to see the areas where you need to improve. Read on to know how to make your platform more secure, efficient, and reliable.</p>
<h2 id="heading-how-to-achieve-kubernetes-security-efficiency-and-reliability">How to Achieve Kubernetes Security, Efficiency, and Reliability</h2>
<p>After the confidence-building phase, the confidence may make you feel too reassured. This may cause a sense of false optimization to permeate throughout your organization. </p>
<p>You may get too comfortable with the technicalities and terminologies. You may miss issues that need tweaking and fortifications.</p>
<p>After building confidence, you must remember to conduct meticulous monitoring. Check for potential issues, responsibilities, and expectations.</p>
<h3 id="heading-how-to-make-kubernetes-secure">How to Make Kubernetes Secure</h3>
<p>Below are some points to remember to help you develop a secure Kubernetes environment.</p>
<p>Remember to follow <a target="_blank" href="https://www.checkpoint.com/cyber-hub/cloud-security/what-is-kubernetes/kubernetes-k8s-security/">standard Kubernetes security</a> procedures. This includes setting limits for individual paths and hostnames against the following:</p>
<ul>
<li>The number of simultaneous connections for IP addresses</li>
<li>The number of requests allowed for every user over a specified period</li>
<li>Request body sizes</li>
</ul>
<p>You must also make sure that you’re keeping your enterprise’s secrets a secret. You should encrypt confidential info, such as passwords and encryption keys. You must encrypt these data before you put them into the infrastructure repository.</p>
<p>You should also have a point person for cluster security and management. The point person will be responsible for enforcing Kubernetes security measures.</p>
<p>You also need to identify the officer or staff responsible for securing your Kubernetes platform. You must have a written list of obligations and expectations for the security staff.</p>
<p>A security point person must be well-versed when it comes to finding misconfigurations. This can prevent security gaps in the implementation of Kubernetes. </p>
<p>They must also be able to spot problems that create vulnerabilities in the system.</p>
<h3 id="heading-how-to-make-kubernetes-efficient">How to Make Kubernetes Efficient</h3>
<p>Your Kubernetes environment isn't mature until your containers operate efficiently. </p>
<p>In order to make this happen, you need to assign someone to take charge of the monitoring of resources. They must be well-versed in the <a target="_blank" href="https://www.fairwinds.com/blog/kubernetes-best-practice-efficient-resource-utilization">Kubernetes best practices for efficient resource usage</a>.</p>
<p>The resource staff must clarify the scope of applications or services. They must always apportion the right amount of resources.</p>
<p>Always check if you're under-provisioning or over-provisioning resources. Neither is acceptable. </p>
<p>Finding the right values for efficient resource provisioning can be tricky. But, you can always use tools that can speed up the process of finding the best values to use.</p>
<p>Other things to keep in mind to ensure Kubernetes cluster efficiency include:</p>
<ul>
<li>Using the latest version of Kubernetes</li>
<li>Employing namespaces to achieve isolation for those trying to access the same clusters</li>
<li>Using small container images</li>
<li>Taking advantage of the Kubernetes Check Probes to prevent pod failures</li>
<li>Autoscaling</li>
<li>Tracking control plane components</li>
<li>Instituting Git-based workflow setups</li>
<li>Monitoring high disk usage</li>
<li>Policy log auditing</li>
</ul>
<h3 id="heading-how-to-make-kubernetes-reliable">How to Make Kubernetes Reliable</h3>
<p>You must have the right configurations to ensure stable operation and streamlined development of your Kubernetes environment. </p>
<p>Misconfigurations are not uncommon in Kubernetes. Below is a guide with helpful tips to prevent misconfigurations.</p>
<ul>
<li><strong>Prefer ephemerality</strong></li>
</ul>
<p>You should use cloud-native architecture to adopt the ephemeral nature of Kubernetes.</p>
<ul>
<li><strong>Take advantage of redundancy</strong></li>
</ul>
<p>Kubernetes supports redundancy to prevent single points of failure. You can use node or anti-affinity selection to achieve high availability.</p>
<ul>
<li><strong>Use traffic readiness checks</strong></li>
</ul>
<p>You must take advantage of the platform’s liveness and readiness probes. These probes can regulate the appropriate sending of traffic to app containers. </p>
<p>Kubernetes, by default, sends traffic to containers immediately. This can become a problem when application pods aren't ready to accept traffic. </p>
<p>Misconfigurations can result in downtime challenges or the possibility of applications becoming unresponsive. </p>
<p>You should take advantage of the platform’s self-healing and auto-scaling functions.</p>
<p>You can also consider using a Kubernetes-native troubleshooting solution. This can help you address problems faster and prevent other reliability issues.</p>
<h2 id="heading-recap">Recap</h2>
<p>The adoption of Kubernetes technology can be a challenging feat for some entrepreneurs. Without the right skills, you can experience issues caused by gaps in operations.</p>
<p>But, there are steps you can take to ensure that your Kubernetes platform is working well.</p>
<p>You must make sure to follow standard Kubernetes security procedures. Hire a point person to be responsible for cluster security and management.</p>
<p>You can use tools to avoid overprovisioning or underprovisioning. Remember to keep in mind the importance of finding the optimal value of resources to use. </p>
<p>Take advantage of the Kubernetes Check Probes to promote improved efficiency and reliability.</p>
<p>You can also use a Kubernetes-native troubleshooting solution. Using this allows you to address issues faster and prevent reliability problems.</p>
<p>You can always fix issues in your operations in the later phase of Kubernetes maturity. But, remember that doing so could have repercussions to your enterprise in the long run.</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ Kubernetes Security – How to Use Dynamic Admission Control to Secure Your Container Supply Chain ]]>
                </title>
                <description>
                    <![CDATA[ By Nahla Davies Containers have exploded in popularity in recent years. And as more developers are using these containers, they need more tools to manage them and their interactions with them effectively.  To help manage all this, many devs use Kuber... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/kubernetes-security-dynamic-admission-control/</link>
                <guid isPermaLink="false">66d460497df3a1f32ee7f877</guid>
                
                    <category>
                        <![CDATA[ Application Security ]]>
                    </category>
                
                    <category>
                        <![CDATA[ container ]]>
                    </category>
                
                    <category>
                        <![CDATA[ containerization ]]>
                    </category>
                
                    <category>
                        <![CDATA[ containers ]]>
                    </category>
                
                    <category>
                        <![CDATA[ cybersecurity ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Kubernetes ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ freeCodeCamp ]]>
                </dc:creator>
                <pubDate>Thu, 05 Aug 2021 16:37:56 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2021/08/pexels-pixabay-39624.jpg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>By Nahla Davies</p>
<p>Containers have exploded in popularity in recent years. And as more developers are using these containers, they need more tools to manage them and their interactions with them effectively. </p>
<p>To help manage all this, many devs use Kubernetes. And it has <a target="_blank" href="https://www.freecodecamp.org/news/the-kubernetes-handbook/">become the de facto standard</a> for container orchestration.</p>
<p>While containers help make the software development and deployment lifecycle more efficient, they can also expand the possible ways hackers can attack your organization. </p>
<p>And while Kubernetes definitely simplifies the process of managing containers, it too has security vulnerabilities. </p>
<p>Given the popularity of Kubernetes, cybercriminals have put a great deal of effort into exploiting those vulnerabilities. As a result, attacks on the supply chain <a target="_blank" href="https://www.darkreading.com/cloud/software-container-supply-chain-sees-spike-in-attacks/d/d-id/1341353">have risen significantly</a> over the last year.</p>
<p>And so securing the Kubernetes supply chain is a high priority for many organizations. </p>
<p>One important security feature that you should pay close attention to if you're a Kubernetes user is dynamic admission control. </p>
<p>In this article, we'll discuss Kubernetes supply chain vulnerabilities and how to address them with dynamic admission control.</p>
<h2 id="heading-vulnerabilities-in-the-kubernetes-supply-chain">Vulnerabilities in the Kubernetes Supply Chain</h2>
<p>Recently, nearly all Kubernetes users <a target="_blank" href="https://www.redhat.com/rhdc/managed-files/cl-state-kubernetes-security-report-ebook-f29117-202106-en.pdf">experienced a security incident</a> caused by various vulnerabilities, ranging from misconfiguration to failed audits. Because of this, security concerns have started to take their toll on deployment practices. </p>
<p>More than half of organizations that use Kubernetes have delayed deploying an application solely based on security issues.</p>
<p>If you want to secure your Kubernetes supply chain, you should have an understanding of the supply chain components for containerized applications and their associated vulnerabilities. </p>
<p>The supply chain extends well beyond Kubernetes itself and <a target="_blank" href="https://www.freecodecamp.org/news/a-simple-introduction-to-kubernetes-container-orchestration/">includes the contents of the containers</a> that Kubernetes manages as well as the container host. </p>
<p>Within the container, you'll typically have a bunch of code from a variety of sources (both internal and external). This gives attackers numerous opportunities to get creative. </p>
<p>To protect against these threats, you need to properly secure all code sets regardless of their source – and this can be challenging. </p>
<p>For example, securing code sourced from Linux distributions such as openssl libraries or glibc may only require you to apply the most recent patch. </p>
<p>But code from other external sources, such as upstream open-source libraries or internal development processes, can be more difficult to secure.</p>
<p>Internal development is perhaps the biggest organizational threat, particularly when developers prioritize speed of release over security.  </p>
<p>Many organizations have decentralized responsibility for container security, with everyone from developers to DevOps getting involved. But more organizations <a target="_blank" href="https://devops.com/from-agile-to-devops-to-devsecops-the-next-evolution/">are building DevSecOps units</a> and placing Kubernetes security in their hands.</p>
<h2 id="heading-how-to-secure-the-kubernetes-supply-chain-with-dynamic-admission-control">How to Secure the Kubernetes Supply Chain with Dynamic Admission Control</h2>
<p>In Kubernetes, dynamic admission control involves user-defined or configured admission controllers rather than standard built-in controllers.</p>
<h3 id="heading-what-are-admission-controllers">What are admission controllers?</h3>
<p>Admission controllers take over after the Kubernetes API server receives an authentication and authorization of a request. These pieces of code intercept the request before a container gets initialized and is added as a pod to the Kubernetes cluster. </p>
<p>Essentially, the admission controller attempts to verify that the image is safe. </p>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/08/image-12.png" alt="Image" width="600" height="400" loading="lazy">
<em><a target="_blank" href="https://kubernetes.io/blog/2019/03/21/a-guide-to-kubernetes-admission-controllers/">Image Source</a></em></p>
<p>Admission controllers <a target="_blank" href="https://www.openpolicyagent.org/docs/v0.11.0/kubernetes-admission-control/">implement a variety of functions</a>, from enforcing resource quotas to running cluster-critical tasks. You'll need to have properly configured admission controllers to properly operate many of Kubernetes' advanced features.</p>
<h3 id="heading-what-are-admission-webhooks">What are admission webhooks?</h3>
<p>Dynamic admission controllers rely on admission webhooks, which are user-defined HTTP callbacks that process admission requests. </p>
<p>In Kubernetes, there are two types of admission webhooks: validating admission webhooks and mutating admission webhooks. </p>
<p>In the admission control process, mutating admission controls run before validating controls. Both types of webhooks are essentially self-explanatory in principle, although their specific operation requires some explanation. </p>
<h4 id="heading-validating-admission-webhooks">Validating admission webhooks</h4>
<p>Validating admission webhooks intercept and validate requests to the Kubernetes API using an external webhook. Importantly, though, they can not mutate requests. </p>
<p>All validating webhooks matching a request run in parallel (because no potential modification can occur), and the controller rejects the request on the failure of any matching webhook. </p>
<p>Validation admission webhooks are all-or-nothing – if the request fails to match precisely, the control rejects it.</p>
<h4 id="heading-mutating-admission-webhooks">Mutating admission webhooks</h4>
<p>In contrast, mutating admission webhooks are able to modify requests, allowing requests that are only slightly non-compliant with the rule to process. </p>
<p>If multiple webhooks match a request, they run serially, and each may modify the request. Because mutating controllers run first, mutated requests can still be rejected by validating webhooks.</p>
<p>The joint operation of mutating and validating admission webhooks allows Kubernetes developers to <a target="_blank" href="https://www.freecodecamp.org/news/how-to-become-a-certified-kubernetes-application-developer/">ensure that requests are compliant</a> and valid before instantiation of containers.</p>
<h2 id="heading-kubernetes-pod-security-policies">Kubernetes Pod Security Policies</h2>
<p>Pod security policies (or PSPs) are a Kubernetes security feature that relies on the implementation of admission controls. </p>
<p>PSPs set conditions and defaults that Kubernetes pods must meet in order to be accepted into the container system. </p>
<p>PSPs can enforce such policies as disabling privileged containers, preventing privilege escalation, and preventing containers from running as root. </p>
<p>PSPs allow admins to enforce organizational security policies across an entire namespace easily. While PSPs require enabling admission controllers, they must be separately enabled.</p>
<p>Under the Kubernetes Pod Security Standards, there are three types of policies:</p>
<ul>
<li>The Baseline Policy has minimal restrictions, although it does not allow privilege escalation. </li>
<li>For the lowest trust users, there is the Restricted Policy which disables certain functions in accordance with pod hardening best practices. </li>
<li>At the highest level is the Privileged Policy, which is the broadest, allowing the most permissions and privilege escalation. </li>
</ul>
<p>Kubernetes started deprecating PSPs with the release of version 1.21. PSPs will be <a target="_blank" href="https://kubernetes.io/blog/2021/04/06/podsecuritypolicy-deprecation-past-present-and-future/">removed entirely in 2022</a> with the release of version 1.25. As a result, if you use Kubernetes you should carefully consider alternative security options for all future container applications.</p>
<h2 id="heading-dont-neglect-standard-kubernetes-security-tools">Don’t Neglect Standard Kubernetes Security Tools</h2>
<p>If you use containers, you should be aware of common vulnerabilities throughout your Kubernetes environment. </p>
<p>To achieve maximum security, both developers and users must apply Kubernetes-specific security features such as dynamic admission control and standard network security features <a target="_blank" href="https://www.freecodecamp.org/news/what-does-a-vpn-do-and-how-does-it-work-a-guide-to-virtual-private-networks/">like VPNs</a>.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/08/image-13.png" alt="Image" width="600" height="400" loading="lazy">
<em><a target="_blank" href="https://securityboulevard.com/2020/03/vpn-a-key-to-securing-an-online-work-environment/">Image Source</a></em></p>
<p>A recent Kubernetes vulnerability involved attackers who had access to the API and who could obtain complete administrator access to a Kubernetes cluster and all associated resources. </p>
<p>A VPN can help avoid this and other similar vulnerabilities where the API server is exposed. But it's important to select the right VPN for your needs.</p>
<h3 id="heading-how-to-choose-a-vpn">How to Choose a VPN</h3>
<p>According to cybersecurity expert Ludovic Rembert of Privacy Canada, encryption protocols <a target="_blank" href="https://privacycanada.net/best-vpn/#:~:text=a%20vpn%20protocol">are the most important factor</a> to look for in a VPN. </p>
<blockquote>
<p>“A VPN protocol determines how your data gets routed between your machine and the server. Different protocols have different costs and benefits depending on what you need. For example, some prioritize privacy and security, while others prioritize speed….a PE Provider Edge device is a single device, or multiple devices, at the edge of the provider’s network. This device then connects through Consumer Edge devices. In this setup, users can view a website, while the provider device is only aware of the VPN device.” – Rembert</p>
</blockquote>
<h2 id="heading-conclusion">Conclusion</h2>
<p>Containerized applications will continue to become more widely used in coming years, as will container management resources <a target="_blank" href="https://www.freecodecamp.org/news/learn-kubernetes-in-under-3-hours-a-detailed-guide-to-orchestrating-containers-114ff420e882/">such as Kubernetes</a>. </p>
<p>As the popularity of these tools increases, the number of attacks at all points in the supply chain will also increase. </p>
<p>So if you work with Kubernetes, you need to take advantage of every security resource available to ensure maximum application security and reliability. </p>
<p>And applying dynamic application controls to verify that the requests are compliant with security policies is one important step in this process.  </p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ Docker Deployment Guide – How to Deploy Containers to the Cloud with AWS Lightsail ]]>
                </title>
                <description>
                    <![CDATA[ By Marcia Villalba Containers have become the de-facto way to develop applications nowadays. They provide a standard way to package all the dependencies that your application needs.  But how you deploy a containerized application to the cloud? The cl... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/how-do-deploy-docker-containers-to-the-cloud-with-aws-lightsail/</link>
                <guid isPermaLink="false">66d46012787a2a3b05af43c6</guid>
                
                    <category>
                        <![CDATA[ AWS ]]>
                    </category>
                
                    <category>
                        <![CDATA[ container ]]>
                    </category>
                
                    <category>
                        <![CDATA[ deployment ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Docker ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Docker Containers ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ freeCodeCamp ]]>
                </dc:creator>
                <pubDate>Tue, 09 Feb 2021 22:45:36 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2021/02/ct-yt--containers--3-.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>By Marcia Villalba</p>
<p>Containers have become the de-facto way to develop applications nowadays. They provide a standard way to package all the dependencies that your application needs. </p>
<p>But how you deploy a containerized application to the cloud? The cloud offers scalability, elasticity, and a "pay for what you use" model that is very desirable in modern applications.</p>
<p>Let's imagine that you have developed your application and packaged it in a Docker container. This application can be your website, some software that you develop for your company, or anything really. </p>
<p>This point is where most basic container and Docker tutorials end. But you want to deploy your application somewhere so others can use it. Now you'll have to start learning about Kubernetes and all the complex orchestration systems. They seem so complicated for just deploying a simple application.</p>
<p>You know that the cloud is the best place to deploy your application. Yet, most of the cloud services out there are complex. </p>
<p>To use them, you need to know specific cloud concepts such as networking, instance types, and others. So many challenges, and you just want to deploy a simple web application.</p>
<p>What if I tell you that there is a cloud service you can use to deploy your containers in a simple way? A service that provides all the benefits from the cloud, and you don't need to use any complex orchestration system to manage the container workloads. </p>
<p>If this sounds interesting, keep on reading. In this post, I will introduce you to Amazon Lightsail. And then I will show you a demo on how to deploy a container application to AWS using Lightsail. </p>
<h2 id="heading-what-is-aws">What is AWS?</h2>
<p><a target="_blank" href="https://aws.amazon.com/">AWS stands for Amazon Web Services</a> and is the most widely-adopted cloud platform. It has lots of different services that help you develop and host your applications. </p>
<p>Using the cloud for your applications has many benefits over using your own on-premise servers. For example, it helps you lower the costs of your application, become more agile, and innovate faster.</p>
<h2 id="heading-what-is-amazon-lightsail">What is Amazon Lightsail?</h2>
<p><a target="_blank" href="https://aws.amazon.com/lightsail/">Amazon Lightsail</a> is part of AWS's cloud-based offerings. It is a service that provides everything you need to deploy applications and websites to the cloud in a simple and cost effective way. </p>
<p>Even the pricing is made simpler – you know every month exactly what you are paying. Amazon Lightsail is an ideal way to deploy simple applications and websites and get started with AWS.</p>
<p>Lightsail is powered under the hood by AWS services such as virtual machines (<a target="_blank" href="https://aws.amazon.com/ec2/">Amazon EC2</a>), relational databases (<a target="_blank" href="https://aws.amazon.com/rds/">Amazon RDS</a>), and other services. It offers the same level of scalability, reliability and security that you expect from any other AWS service.</p>
<p>At the end of 2020, <a target="_blank" href="https://aws.amazon.com/blogs/aws/lightsail-containers-an-easy-way-to-run-your-containers-in-the-cloud/">Lightsail added support for deploying containers to the cloud</a>. To do this, all you need is to provide a Docker image for your containers and Lightsail will automatically deploy it for you. </p>
<p>Lightsail provides an HTTPS endpoint that is ready to serve your application. It also takes care of load balancing and orchestrating the application.</p>
<h2 id="heading-how-to-deploy-an-application-with-lightsail">How to Deploy an Application with Lightsail</h2>
<p>Let's see how Lightsail works by deploying a simple NodeJS application packaged as a container image. This image is the one that <a target="_blank" href="https://www.docker.com/101-tutorial">Docker Desktop provides</a> for learning their platform. </p>
<p>We will start this demo where most tutorials end – when your application image is hosted in <a target="_blank" href="https://hub.docker.com/">Docker Hub</a>.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/02/docker1010.png" alt="Image" width="600" height="400" loading="lazy"></p>
<h3 id="heading-step-1-setup-your-aws-account">Step 1 - Setup your AWS account</h3>
<p>The first step in this tutorial is to get an <a target="_blank" href="https://portal.aws.amazon.com/billing/signup">AWS account</a>. In this AWS account you will be deploying your containers.</p>
<p>If you are just creating your account, the <a target="_blank" href="https://aws.amazon.com/free/">free tier</a> should be enough for this project. The free tier will give you access to a lot of AWS services for free for the first 12 months. And you will get one month of Amazon Lightsail for free.</p>
<p>Keep in mind that having an AWS account is free if you don’t use any services. You won’t be charged for creating the account, and if you don’t use the account, nothing will be charged.</p>
<p>To create an AWS account you can follow the steps in this video:</p>
<div class="embed-wrapper">
        <iframe width="560" height="315" src="https://www.youtube.com/embed/9_wo0FHtVmY" style="aspect-ratio: 16 / 9; width: 100%; height: auto;" title="YouTube video player" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen="" loading="lazy"></iframe></div>
<h3 id="heading-step-2-create-your-container-service">Step 2 - Create your container service</h3>
<p>By now you should have an AWS account and your application in Docker Hub - as this <a target="_blank" href="https://www.docker.com/101-tutorial">Docker Desktop</a> tutorial shows.</p>
<p>Log into your AWS account and go to Amazon Lightsail.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/02/01lightsail.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>Amazon's Lightsail interface is quite different from the regular AWS interface. You can see that this interface has many tabs available. The one we are interested in for this post is <strong>Containers.</strong> But in a similar way you can create virtual instances, databases, and other cloud components using Lightsail.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/02/02lightsail.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>Now we can <strong>create a container service</strong>, and that will take us to a form where we need to make some simple decisions. </p>
<p>The first one is in which region we want to deploy our container image. Amazon Lightsail is available in all these regions, so you can pick the one that is the best for your application. </p>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/02/03lightsail.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>After that, we need to choose how much power to give to the machine that will be running our containerized application. We need to decide on the size of the machine, and how many of them we need. </p>
<p>You can see how much it will cost per machine and how much memory and CPU each of them have. In addition, after you select the scale, you can see exactly how much this service will cost.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/02/04lightsail.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>Lightsail is very clear when it comes to cost. We can see the end cost on the screen. That includes storage, load balancing, networking, and whatever this container needs to run.</p>
<p>Then we need to setup our deployment. The container service we are creating can hold up to 10 container's images. </p>
<p>For each of the containers, we need to define a name, where the image is (the URL from Docker Hub) and how we'll run and access this application. </p>
<p>In our case, we will open port 3000 with the protocol HTTP so the application can be accessed via that URL.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/02/05lighsail.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>The last thing we need to configure is a <strong>public endpoint</strong>. You can choose from your deployment what container you want to make a public endpoint on the internet.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/02/06lightsail.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>After that, you are ready to <strong>start</strong> the deployment. This takes a couple of minutes. After you are done you can access the public endpoint for this service.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/02/07lightsail.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>At the top of the container service page, you can see the <strong>public domain</strong>. When you click that URL, you will be accessing the application you defined in the public endpoint. </p>
<p>If you need your containers to talk to each other without making them public, use the <strong>private domain</strong>.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/02/08lightsial.png" alt="Image" width="600" height="400" loading="lazy"></p>
<h2 id="heading-conclusion"><strong>Conclusion</strong></h2>
<p>Now you have a container application deployed in the cloud. This application is scalable. You can monitor the usage of the power you defined before in the <strong>Metrics</strong> tab. You can always modify these specs if you see that you need more or less power.</p>
<p>In addition, if you need a domain for your application, you can get one from the <a target="_blank" href="https://lightsail.aws.amazon.com/ls/docs/en_us/articles/understanding-dns-in-amazon-lightsail">Amazon Lightsail console</a>. </p>
<p>If you want to watch this blog post as a video you can check it out here where we do the same together. <a target="_blank" href="https://www.youtube.com/watch?v=V-C_ZJi6-o0&amp;t=432s">This video is also available in Spanish if you prefer</a>. </p>
<div class="embed-wrapper">
        <iframe width="560" height="315" src="https://www.youtube.com/embed/xMudAoq-vmI" style="aspect-ratio: 16 / 9; width: 100%; height: auto;" title="YouTube video player" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen="" loading="lazy"></iframe></div>
<p><strong>Thanks for reading.</strong></p>
<p>I’m Marcia Villalba, Developer Advocate for AWS and the host of a YouTube channel called FooBar. There I published over 300 video tutorials about Serverless, AWS and software engineer practices.</p>
<ul>
<li>Twitter: <a target="_blank" href="https://twitter.com/mavi888uy">https://twitter.com/mavi888uy</a></li>
<li>Youtube: <a target="_blank" href="https://youtube.com/foobar_codes">https://youtube.com/foobar_codes</a></li>
<li>Spanish Youtube channel: <a target="_blank" href="https://bit.ly/aws-esp-yt">https://bit.ly/aws-esp-yt</a></li>
</ul>
 ]]>
                </content:encoded>
            </item>
        
    </channel>
</rss>
