<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Muhammad Haris Anwar on Medium]]></title>
        <description><![CDATA[Stories by Muhammad Haris Anwar on Medium]]></description>
        <link>https://medium.com/@i180608?source=rss-2f5f7fe0815a------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*6CrWUgH4QzaYdJAL</url>
            <title>Stories by Muhammad Haris Anwar on Medium</title>
            <link>https://medium.com/@i180608?source=rss-2f5f7fe0815a------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 10:10:21 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@i180608/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[What is Docker Container And Difference Between Docker, Container, And VM]]></title>
            <link>https://medium.com/@i180608/what-is-docker-container-and-difference-between-docker-container-and-vm-58654baae96?source=rss-2f5f7fe0815a------2</link>
            <guid isPermaLink="false">https://medium.com/p/58654baae96</guid>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[vm]]></category>
            <category><![CDATA[docker-image]]></category>
            <category><![CDATA[containers]]></category>
            <dc:creator><![CDATA[Muhammad Haris Anwar]]></dc:creator>
            <pubDate>Thu, 01 Dec 2022 07:45:17 GMT</pubDate>
            <atom:updated>2022-12-01T07:45:17.314Z</atom:updated>
            <content:encoded><![CDATA[<p>Let&#39;s try to understand the Docker container with an actual example, you are the developer and you develop some code for your project in a development environment the runtime engine for your development environment is python 3.8 and you are importing a couple of dependencies may be requested and you also have a configuration file with the DNS service name and the database connection. So everything works great in the development environment then you move your code to the test environment. In the test environment, the runtime engine is python 3.6. So one of your codependency works but, the other one may be the kitchen sync one breaks and your configuration file also works so you are thinking all right I need to change the code a little bit I guess that’s okay then one fine day your code gets moved into prod. So prod runtime engine generally is always behind so in prod your company is running python 2.7. So there both of your dependencies break the configuration file breaks and basically, your code is crashing and burning at this point.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zbOISFWZGQTraKgOGWKL8w.png" /></figure><p>So what is a container? It is an atomic self-contained package of software that includes everything it needs to run code runtime libraries packages etc.</p><h3>Docker Image VS Container</h3><p>Once you package your code, configuration, dependencies, and runtime engine you create a docker image also known as a container image, at this point your application is not running you just have the image of your application, and when you run the docker image or container image it creates a container.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qCyl2WCJ4VH77KsQFaB9mA.png" /><figcaption>Docker Image VS container</figcaption></figure><p>In the beginning, you have your app maybe it’s written in java or python or any other language and then you have this file called docker file which dockerizes your app so this docker file. Basically, the application needs some dependencies, configuration, runtime, and it also has a command to create the docker image for your application. So once you have the docker image you have to save the docker image somewhere that is called a repository. So this is very similar to when you save your jar file for your java application in a repository. So a couple of popular docker image repositories are docker hub and elastic container registry then your docker image gets deployed into the container. So this is when your app starts running inside the container one thing to note at this point, you can really run your application as a container in any platform that supports docker. So one of the most popular platform to run your container is Kubernetes, and Kubernetes has different flavors so we, of course, has amazon EKS which is the most popular and we also have google Kubernetes engine but since Kubernetes is open source you can install Kubernetes on vanilla EC2 and run your container there and that’s not it you can run into any Kubernetes cluster implementation even on-prem.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nWi5tMEJ8Ab0yoh5cJK_LQ.png" /></figure><h3>Virtual Machine VS Container</h3><p>This is important to understand the difference between virtual machines such as ec2 and containers.</p><p>So containers and virtual machines have some similarity in resource isolation but it functions differently so virtual machines are an abstraction of physical hardware turning one server into many servers the hypervisor allows multiple virtual machines to run on a single machine but the VM has your application the libraries and runtimes but it also has to have a guest operating system and this guest operating system takes up tens of gigabytes of space also this operating system can be slow to boot.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0JJ7fhfWIsWA-oLGKXVzRg.png" /><figcaption>Virtual Machine VS Container</figcaption></figure><p>So now if we take a look into containers, they are an obstruction at the application layer that packages code and dependencies together multiple containers can run on the same machine and share the operating system kernel with other containers. So since in this case, we don’t need to package up a guest operating system into our container it takes way less space than VM. So that’s why even though the size of the underlying server is the same for these two diagrams, But has way more containers than the VM.</p><h3>Advantages of docker container</h3><ol><li>Since you are packaging everything you need to run your code it is platform independent it’s truly build it once and run it anywhere.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lSgNQAr19CocaoX4olJ9UQ.png" /></figure><p>2) So instead of just deploying the code in a different environment with different runtime engines now package the code, runtime engine which is python 3.8, dependencies, and any other necessary components into a docker image and that docker image runs seamlessly in dev-test, and production.</p><p>3) Better resource utilization since containers do not require a separate operating system they use much less resources than VM this makes it possible to run many more containers than VM on a single server and since containers have a higher utilization level with regards to the hardware you require. Less hardware results in a reduction in costs.</p><p>4) Application isolation, although containers run on the same server they are isolated from each other if one application crashes other containers will keep running flawlessly and won’t experience any technical problems this isolation also decreases security risks if one application is hacked or breached by malware any negative effects will not spread to the other running containers. Containers are fast to create replicate or destroy.</p><p>5) containers are lightweight and start very very quickly because they do not need an operating system boot what this means is your application can scale very very quickly.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=58654baae96" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Build Node Application Using Buildx]]></title>
            <link>https://medium.com/@i180608/build-node-application-using-buildx-ef5a5a82e74?source=rss-2f5f7fe0815a------2</link>
            <guid isPermaLink="false">https://medium.com/p/ef5a5a82e74</guid>
            <dc:creator><![CDATA[Muhammad Haris Anwar]]></dc:creator>
            <pubDate>Mon, 24 Oct 2022 15:06:20 GMT</pubDate>
            <atom:updated>2022-10-24T15:06:20.946Z</atom:updated>
            <content:encoded><![CDATA[<p>Using buildx to build a simple node application container image and then run it as a container on both x86 and arm servers within AWS. here’s the simple server course code using the built-in http module.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sdMJ4Z0eGmJgE8Vrmgy0LA.png" /></figure><p>when a request is made to the server it just responds with a hello world message but also includes the <strong>process.arch</strong> variable which will tell us which processor architecture is being used.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rwf4sJ2aRY5GsJlpnnv38Q.png" /></figure><p>To containerize the app ,start from the node base image which supports multiple architectures and then set the working directory to a standard convention of user source app. Next copy package.json and install the dependencies since almost any node application will, Not every dependency will work out of the box across architectures so you may need to do some experimentation here to get things working. Next execute server.js file to start the server.</p><p>Now we can go through the process of actually using buildx to build the images. First we want to authenticate to the docker registry using docker login I’m using docker hub here as the remote registry but most registries should support multi-architecture images.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*g5YAtAbYJFAA13uf0l4TQg.png" /></figure><p>In this way next I’ll run the “<strong><em>docker</em></strong> <strong><em>buildx ls”</em></strong> command this will show the available builders if you’ve never used buildx before you should see a single builder return name default while we could use this default builder it’s recommended to create a new builder using the “<strong><em>docker buildx create”</em></strong> and then passing the name of the new builder this builder provides a scoped environment for our builds and so if we make a mistake configuring it we can always wipe it out and create a new one without affecting the default settings we now need to tell docker to use this new builder with the buildx use command finally we want to inspect our builder to make sure it’s configured correctly the dash bootstrap flag ensures that the driver is running. Before we inspect it this final step isn’t strictly necessary because docker would automatically bootstrap the build when building our images but it’s useful to confirm that our configuration matches the expectation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*V__kN-G-mNX4-a2bnxcFEQ.png" /></figure><p>Next step is to create a new repository within docker hub then build the images. We use docker buildx build and then the dash t flag allows us to tag the image there’s two new options used here specific to buildx</p><p>The platform option allows us to specify which architectures we want to build the images for</p><p>The push flag will automatically push the image and the manifest to our remote registry.</p><p>when execute this command the terminal is flooded with text showing us all the steps that docker is executing. Point out here that the prefix on each line shows the different architectures and how buildx is managing and building those in parallel once the process completes visit the image within docker hub and see that it now shows support for multiple architecture how do we actually go about running these images when running a container.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FHagWf65dzzKYDrJomVK0A.png" /></figure><p>docker is smart enough to auto detect the architecture of the host system and use the corresponding image so when run this test container on my intel based processor it will automatically grab the amd64 image or on one of the new m1 MacBook it would instead pull and use the arm 64 image.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ef5a5a82e74" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Multi-Architecture Docker Images]]></title>
            <link>https://medium.com/@i180608/multi-architecture-docker-images-108f59a18a20?source=rss-2f5f7fe0815a------2</link>
            <guid isPermaLink="false">https://medium.com/p/108f59a18a20</guid>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[containers]]></category>
            <category><![CDATA[multi-architecture]]></category>
            <category><![CDATA[blog]]></category>
            <category><![CDATA[buildx]]></category>
            <dc:creator><![CDATA[Muhammad Haris Anwar]]></dc:creator>
            <pubDate>Thu, 15 Sep 2022 12:07:59 GMT</pubDate>
            <atom:updated>2022-09-20T20:53:41.017Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Processor Architecture Overview:-</strong></p><p>How to build container images that can be deployed across multiple processor architectures? this is becoming increasingly important as ARM-based processors make their way into both developer systems as well as cloud-based servers most of the development systems have run CPUs from Intel and AMD using the x86 or AMD architecture over on the server side the software is usually deployed on to systems running different chips from those companies but with the same architectures because these systems are using the same architecture building and running docker containers just works across them nothing special is required.</p><h4><strong>The Rise of ARM:-</strong></h4><p>However, in the past few years, there’s been a rise in the competing architecture known as ARM systems like the raspberry pi. More recently, the apple silicon max has become more prominent. ARM processors are also starting to pop up on the deployment side with containers being run on the embedded systems and AWS releasing their custom graviton chips using ARM in their A1 series virtual machines like the x86 architecture above if you are building and running containers on similar architectures it should just work but what about these other use cases. Can we build a container image on an Intel-based laptop and then run it on an ARM-based server in AWS? Yes, you can.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*N6JUEt1WvGFryjB0X3y7TQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bRI1LWI_K3xpEo2Bg0LiWw.png" /></figure><p>Two relatively recent developments are making this unique in history for ARM-based processors.</p><p>· First is the transition of apple max onto the new apple silicon chips this change will mean the percentage of engineers developing ARM-based systems will increase dramatically in the coming years.</p><p>· Secondly the release and the maturation of ARM-based virtual machines in AWS.</p><h4><strong>Multi Architecture Docker Manifests:-</strong></h4><p>Suspect that other cloud providers will soon follow suit and start offering competing ARM-based servers so, we can handle cross-architecture builds with docker but how does this actually work the first topic to explore is multi-architecture manifests if we run the docker manifest and spec command on a popular base image such as the official node.js image we see that the manifest printed to the terminal in JSON actually contains three separate manifests within the array each with a different architecture one for amd64 one for arm32 and a third for arm64. within the docker hub interface these different architectures show up as separate digests most official docker images these days support multiple architectures in this way for example 166 official images published by the docker organization 118 of them support both x8664 and arm 64. There are two ways that this type of images can be built the older method of creating multiple architecture images is a bit labor intensive. First, you had to have systems natively running each architecture you wanted to target so you might have a build farm with one Intel-based system, one 64-bit ARM machine, and a 32-bit ARM machine, then run your build command on each of them using separate docker files to handle any discrepancies between the two architecture once they’re built you can create a combined manifest using the manifest create command this manifest then gets pushed to the docker registry alongside the images this method works fine but it can be a bit clunky.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mWhoohQ06hs6lf4ohLhVhg.png" /></figure><h4><strong>Buildx:-</strong></h4><p>In 2019 docker announced a new method for building multi-architecture images which they call buildx depending on which version of docker you’re using this may or may not be an experimental feature that being said. It is built on top of a build kit that has been around for quite some time and is fairly stable buildx does a number of cool things related to multi-architecture images first of which is being able to take a set of systems natively running each of the target architectures like before and turn them into a true build farm.</p><p>Building images in parallel with buildx managing the process the second method of using buildx is using a single node along with QEMU an open source machine emulator that allows you to emulate one processor architecture on another this is super cool because now as a developer you can have a single system running either x86 or arm and build docker images compatible with both. Working on a MacBook pro with an Intel-based processor the process of using buildx to build a simple node application container image and then run it as a container on both x86 and arm servers within AWS.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fs_fMV3QYpCRmu29QH7DDQ.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=108f59a18a20" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>