<?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 Fatima Maryam on Medium]]></title>
        <description><![CDATA[Stories by Fatima Maryam on Medium]]></description>
        <link>https://medium.com/@fatimamaryamrauf?source=rss-3fb11c88733------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*hfyAoxZpk5GwxqSBjQWpyA.png</url>
            <title>Stories by Fatima Maryam on Medium</title>
            <link>https://medium.com/@fatimamaryamrauf?source=rss-3fb11c88733------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 16:02:03 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@fatimamaryamrauf/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[PromptOps: A sneak-peak into how Generative AI is enabling DevOps]]></title>
            <link>https://medium.com/@fatimamaryamrauf/promptops-and-kubiya-ai-a-sneak-peak-into-how-generative-ai-is-enabling-devops-da4baaaae3ed?source=rss-3fb11c88733------2</link>
            <guid isPermaLink="false">https://medium.com/p/da4baaaae3ed</guid>
            <category><![CDATA[generative-ai-use-cases]]></category>
            <category><![CDATA[generative-ai-tools]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[generative-ai-solution]]></category>
            <dc:creator><![CDATA[Fatima Maryam]]></dc:creator>
            <pubDate>Fri, 27 Oct 2023 07:37:26 GMT</pubDate>
            <atom:updated>2023-10-27T08:28:23.681Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/919/1*MJeXvqu2cBBx0OzC_cycjQ.png" /><figcaption>Image source = <a href="https://www.xenonstack.com/blog/generative-ai-usecases-for-devops-and-it">https://www.xenonstack.com/blog/generative-ai-usecases-for-devops-and-it</a></figcaption></figure><h3><strong>What is Generative AI?</strong></h3><p>Wikipedia describes Generative AI as “Generative artificial intelligence is artificial intelligence capable of generating text, images, or other media, using generative models. Generative AI models learn the patterns and structure of their input training data and then generate new data that has similar characteristics.” thus in simpler terms it can be described as a branch of AI that generates new content in various formats.</p><h3>A brief background on Generative AI</h3><p>Gen-AI (short for Generative AI) stems from a class of algorithms that generate new content such as images, movies, text, code, music or other audio. Gen AI’s origin goes quite a while back to a much older distinction in machine learning between generative algorithms and discriminative algorithms.</p><p>Discriminators are algorithms such as spam classifiers that looks at a bunch of emails and classifies these emails into some that look suspicious and some that do not. On the other hand, generative models try to create new content by modelling the entire distribution of the data that they observe. By being able to sample new data points they’re able to create new plausible content that did not exist before.</p><p>Generative algorithms like Markov models have existed for decades however, the quality of output across a bunch of modalities across text, images and code only got to where it is today because of a breakthrough architecture called the Transformer which came out in 2017 and essentially underlies all of the AI models such as ChatGPT, Bard, etc. that you see today.</p><p>All these models take their own output and try to predict the next output based on the the recent window which is similar to observing what is the local pattern of a bunch of words and then based on that predicting the next word or observing a bunch of characters and based on that predicting the the next character or similarly observing a bunch of code to predict the the next line of code. That is different to other machine learning algorithms which try to generate entire block of code or an image at once .They’re not trying to model the local patterns but rather they are looking at global patterns.</p><h3><strong>What is DevOps?</strong></h3><p>DevOps is a methodology in the software development and IT industry. It is used as a set of practices and tools whereby DevOps integrates and automates the work of software development and IT operations as a means for improving and shortening the systems development life cycle.</p><p>In fact, ChatGPT has an interesting way of explaining DevOps and its as follows “DevOps is like a well-organized team of chefs in a restaurant. Instead of the kitchen staff (developers) and the waitstaff (operations) working separately, they collaborate closely. They share recipes (code) and work together to quickly prepare and serve delicious dishes (software) to customers (users). This teamwork speeds up the cooking process, ensures the food is always fresh, and allows for fast adjustments if customers want changes. In a similar way, DevOps brings together software development and IT operations to create and deliver software more efficiently and with fewer errors.”</p><h3><strong>How is Generative AI enabling DevOps?</strong></h3><p>Generative AI has the potential to revolutionize DevOps practices by automating and optimizing various aspects of the software development lifecycle. It has several use-cases such as in Continuous Integration and Deployment, Automated Infrastructure Provisioning, Automated Configuration Management, Automated Release Notes and Documentation, Automated Quality Assurance, and Automated Performance Optimization. You can read about all the different use-cases of Generative AI in DevOps in the links provided in the resources section at the end of this article.</p><p>Increasingly, there are tools and technologies coming into the marketplace such as PromptOps which hope to solve challenges in the DevOps space using GenAI.</p><h3><strong>What is PromptOps?</strong></h3><p>In the similar way that new lines of code can be generated when the model observes a bunch of previous lines of code, you could use Generative-AI in an IT setting to predict the next actions that an admin might take. Just like a lot of what is currently being done in the DevOps space is repetitive. This is because the daily work of a DevOps professional can involve the same troubleshooting and reporting over and over again. Therefore, a lot of what PromptOps does is repetitive.</p><p>For example, if you go to Stack Overflow, you’ll see the same question might have 500,000 views which means its a common problem so it makes sense to automate these actions wherever possible. PromptOps can do that, without the messy trial-and-error tribulations to work out an automation script.</p><p>One thing PromptOps does is intent matching. A DevOps pro may ask PromptAI to “Spin up a cluster.” But what does that mean? A Kubernetes cluster, an RDS cluster, or another cluster entirely? PromptOps will make use of past history with which to fill in that intent gap to conclude that what is being asked is a Kubernetes cluster.</p><p>Most of PromptOps usage of generative AI is actually offline so that it does not impact the experience of the user. Instead, it is used for preparation to automate common sets of actions as discussed in detail below.</p><h3><strong>A brief background on PromptOps</strong></h3><p>The PromptOps Team was founded by combining team members from two different teams. Half of the team came from a DevOps Observability company called Wavefront and the other half from a flagship machine learning project at VMware. Wavefront had great customers like Lyft but at one point the team realized that they were working as a metrics company and that the data wasn’t actually helping these big companies get any better at DevOps as they already had enough data and were swimming in metrics, logs and etc.</p><p>The bottleneck had become the process not the data especially how to interpret the data, what to do with the data, how to act on the data, etc. These are the things that are hard for people to learn and hard to teach and formalize. Data is like the tip of the iceberg (the most invisible part) but all the process underneath that tip is actually the bulk of what is done in DevOps and also the bottleneck to DevOps today.</p><h3><strong>How is PromptOps different from its competition?</strong></h3><p>Companies “will tend to staple LLMs onto their products to make them easier to use,” Nag the founder of PromptOps said. “But I think the scope of what’s possible here is just a lot wider. For us, we’re not trying to make one legacy product easier to use, we’re trying to leverage all of DevOps, with this amazing technology.”</p><h3><strong>Resources:</strong></h3><ul><li><a href="https://www.xenonstack.com/blog/generative-ai-usecases-for-devops-and-it">Generative AI Use Cases for DevOps and IT</a></li><li><a href="https://thenewstack.io/promptops-how-generative-ai-can-help-devops/">PromptOps: How Generative AI Can Help DevOps</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=da4baaaae3ed" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Top 6 tips for Docker Image Optimization]]></title>
            <link>https://medium.com/@fatimamaryamrauf/top-5-tips-for-docker-image-optimization-3ba4e25557fb?source=rss-3fb11c88733------2</link>
            <guid isPermaLink="false">https://medium.com/p/3ba4e25557fb</guid>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[dockerfiles]]></category>
            <category><![CDATA[optimization]]></category>
            <category><![CDATA[containers]]></category>
            <category><![CDATA[docker-image]]></category>
            <dc:creator><![CDATA[Fatima Maryam]]></dc:creator>
            <pubDate>Sat, 17 Sep 2022 15:38:36 GMT</pubDate>
            <atom:updated>2023-01-16T05:46:49.142Z</atom:updated>
            <content:encoded><![CDATA[<h4>Learn some best practices for writing a Dockerfile to enable smaller image size and faster builds</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OTLU6kstNgX7o_yR7HQVdA.png" /><figcaption><strong>Image Source</strong>: <a href="https://medium.com/swlh/understand-dockerfile-dd11746ed183">https://medium.com/swlh/understand-dockerfile-dd11746ed183</a></figcaption></figure><h4>What are Containers?</h4><p>In the current times, technologies such as Docker and containers have been all the hype, and reasonably so. Containers provide a consistent, portable and efficient way to <strong>package and run an application, along with its dependencies, in an isolated, predictable and repeatable way</strong>.</p><h4>Dockerfile, Docker Image and a Container</h4><p>The current most common way of creating containers is by <strong>writing a Dockerfile</strong> which is then <strong>built to produce a Docker Image</strong>. When we <strong>run the Docker Image, we get a Docker Container.</strong> Thus the <strong>practices you use to write your dockerfile impact the size of the resulting image</strong> and the time it will take to build it.</p><h4>Need for Optimization of Docker Images</h4><p>Now you might be thinking, that is fine and all but why do we even want to optimize our docker images? Well there are several comprehensive reasons for this as summarized in the following bullet points:</p><ol><li><strong>Large image size</strong> require <strong>more cost</strong> when hosted on cloud.</li><li><strong>Large images </strong>results in a <strong>slower build time</strong>.</li><li>It takes <strong>more time to push and pull the image</strong> to an online central repository like DockerHub.</li><li>Large images take <strong>more disk space</strong>.</li><li>They take <strong>more time to download and extract</strong> thus<strong> increasing</strong> the <strong>container start time</strong>.</li></ol><h4>Tips for Optimization of Docker Images</h4><p>Below we look at some best practices for writing a Dockerfile which will result in an optimized final docker image. Let’s go 🏃‍♂️🏃‍♀️</p><h4>1. Use a Lightweight Official Docker Image as your Base Image</h4><p>A dedicated team reviews and publishes official docker images. The dockerfiles of these images are well written and follow best practices. Docker Inc. also ensures that patches and fixes are applied to these images in a timely manner.</p><p>The simplest and most common way of reducing a Docker image size is by using a <strong>base image with minimal size</strong>. Some examples are <strong>Alpine Images</strong> which are created especially for use in containers. Another is <strong>Slim Images </strong>which are a smaller sized version of the base image with lesser packages.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcarbon.now.sh%2Fembed%3Fbg%3Drgba%2528220%252C209%252C209%252C1%2529%26t%3Dsolarized%2Blight%26wt%3Dnone%26l%3Dauto%26width%3D809.5%26ds%3Dtrue%26dsyoff%3D20px%26dsblur%3D68px%26wc%3Dtrue%26wa%3Dfalse%26pv%3D56px%26ph%3D56px%26ln%3Dtrue%26fl%3D1%26fm%3DHack%26fs%3D14px%26lh%3D143%2525%26si%3Dfalse%26es%3D2x%26wm%3Dfalse%26code%3D%252523%252520will%252520automatically%252520pick%252520the%252520%252522latest%252522%252520build%25250AFROM%252520node%25250A%25250A%252523%252520use%252520line-8%252520instead%252520of%252520line-2%25250A%252523%252520line-8%252520makes%252520use%252520of%252520a%252520minimal%252520size%252520official%252520docker%252520image%252520%25250A%252523%252520also%252520uses%252520a%252520specific%252520tag%252520thus%252520base%252520image%252520is%252520pinned%252520to%252520a%252520specific%252520version%25250A%25250AFROM%252520node%25253A14.14.0-alpine3.12&amp;display_name=Carbon&amp;url=https%3A%2F%2Fcarbon.now.sh%2F%3Fbg%3Drgba%252528220%25252C209%25252C209%25252C1%252529%26t%3Dsolarized%2Blight%26wt%3Dnone%26l%3Dauto%26width%3D809.5%26ds%3Dtrue%26dsyoff%3D20px%26dsblur%3D68px%26wc%3Dtrue%26wa%3Dfalse%26pv%3D56px%26ph%3D56px%26ln%3Dtrue%26fl%3D1%26fm%3DHack%26fs%3D14px%26lh%3D143%252525%26si%3Dfalse%26es%3D2x%26wm%3Dfalse%26code%3D%25252523%25252520will%25252520automatically%25252520pick%25252520the%25252520%25252522latest%25252522%25252520build%2525250AFROM%25252520node%2525250A%2525250A%25252523%25252520use%25252520line-8%25252520instead%25252520of%25252520line-2%2525250A%25252523%25252520line-8%25252520makes%25252520use%25252520of%25252520a%25252520minimal%25252520size%25252520official%25252520docker%25252520image%25252520%2525250A%25252523%25252520also%25252520uses%25252520a%25252520specific%25252520tag%25252520thus%25252520base%25252520image%25252520is%25252520pinned%25252520to%25252520a%25252520specific%25252520version%2525250A%2525250AFROM%25252520node%2525253A14.14.0-alpine3.12&amp;image=https%3A%2F%2Fcarbon.now.sh%2Fstatic%2Fbrand%2Fbanner.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=carbon" width="1024" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/7268ddfb0cd0f19101eca6420e1e839a/href">https://medium.com/media/7268ddfb0cd0f19101eca6420e1e839a/href</a></iframe><p>👍 [Pro Tip] When choosing the base image, it’s recommended to use a specific <strong><em>tag</em></strong>.</p><p>Starting a Dockerfile as shown in line-8 is recommended because it has the base image pinned to a specific version. We pin versions to ensure consistency and certainty. When you use a version tag with your base image; you know exactly which version is used at any time.</p><p>The problem with using unpinned dependency is that consistency is not guaranteed. Similarly, avoid using the <strong>latest</strong> tag for the image. The latest tag or an unpinned dependency can have breaking changes over time. Therefore, its best to avoid them when writing your dockerfiles.</p><h4>2. Utilize Multi-stage Builds</h4><p>A multi-stage build is a method whereby you organize your Docker instructions in such a way that the final image contains only what you need at the production stage. So in short, this means getting rid of any and all build dependencies especially those at the development stage.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/889/1*fgMj8Jb-bJT8_NA5azseWQ.png" /><figcaption>Image Source: <a href="https://devopscube.com/reduce-docker-image-size/">https://devopscube.com/reduce-docker-image-size/</a></figcaption></figure><p>A Docker image becomes large because your app needs to <strong>download and compile dependencies</strong> used by your app. The image size increases due to <strong>unneeded files &amp; folders that you only need to <em>build/install</em>, but not to <em>run</em></strong> your application.</p><p>For example, you need to install a <strong>package manager</strong> (e.g. apt-get install python3-pip) to get the dependencies. However, you don’t need the package manager (such as pip) or a compiler to run your application! This is where multi-stage builds come in.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcarbon.now.sh%2Fembed%3Fbg%3Drgba%2528220%252C209%252C209%252C1%2529%26t%3Dsolarized%2Blight%26wt%3Dnone%26l%3Dauto%26width%3D809.5%26ds%3Dtrue%26dsyoff%3D20px%26dsblur%3D68px%26wc%3Dtrue%26wa%3Dfalse%26pv%3D56px%26ph%3D56px%26ln%3Dtrue%26fl%3D1%26fm%3DHack%26fs%3D14px%26lh%3D143%2525%26si%3Dfalse%26es%3D2x%26wm%3Dfalse%26code%3D%252523%252523%252520Build%252520Stage%25250AFROM%252520golang%25253A1.16-buster%252520AS%252520build%25250AWORKDIR%252520%25252Fapp%25250ACOPY%252520go.mod%252520.%25252F%25250ACOPY%252520go.sum%252520.%25252F%25250ARUN%252520go%252520mod%252520download%25250ACOPY%252520%252A.go%252520.%25252F%25250ARUN%252520go%252520build%252520-o%252520%25252Fdocker-gs-ping%25250A%25250A%252523%252523%252520Deploy%25252FProduction%252520Stage%25250AFROM%252520gcr.io%25252Fdistroless%25252Fbase-debian10%25250AWORKDIR%252520%25252F%25250A%252523using%252520the%252520final%252520result%252520of%252520the%252520previous%252520build%252520stage%252520from%252520above%25250ACOPY%252520--from%25253Dbuild%252520%25252Fdocker-gs-ping%252520%25252Fdocker-gs-ping%25250AEXPOSE%2525208080%25250A%252523%252520user%252520is%252520specified%252520as%252520nonroot%252520to%252520optimize%252520security%252520as%252520normally%252520docker%252520runs%252520with%252520root%252520privileges%252520which%252520can%252520access%252520the%252520kernel%252520%25250AUSER%252520nonroot%25253Anonroot%25250AENTRYPOINT%252520%25255B%252522%25252Fdocker-gs-ping%252522%25255D&amp;display_name=Carbon&amp;url=https%3A%2F%2Fcarbon.now.sh%2F%3Fbg%3Drgba%252528220%25252C209%25252C209%25252C1%252529%26t%3Dsolarized%2Blight%26wt%3Dnone%26l%3Dauto%26width%3D809.5%26ds%3Dtrue%26dsyoff%3D20px%26dsblur%3D68px%26wc%3Dtrue%26wa%3Dfalse%26pv%3D56px%26ph%3D56px%26ln%3Dtrue%26fl%3D1%26fm%3DHack%26fs%3D14px%26lh%3D143%252525%26si%3Dfalse%26es%3D2x%26wm%3Dfalse%26code%3D%25252523%25252523%25252520Build%25252520Stage%2525250AFROM%25252520golang%2525253A1.16-buster%25252520AS%25252520build%2525250AWORKDIR%25252520%2525252Fapp%2525250ACOPY%25252520go.mod%25252520.%2525252F%2525250ACOPY%25252520go.sum%25252520.%2525252F%2525250ARUN%25252520go%25252520mod%25252520download%2525250ACOPY%25252520%25252A.go%25252520.%2525252F%2525250ARUN%25252520go%25252520build%25252520-o%25252520%2525252Fdocker-gs-ping%2525250A%2525250A%25252523%25252523%25252520Deploy%2525252FProduction%25252520Stage%2525250AFROM%25252520gcr.io%2525252Fdistroless%2525252Fbase-debian10%2525250AWORKDIR%25252520%2525252F%2525250A%25252523using%25252520the%25252520final%25252520result%25252520of%25252520the%25252520previous%25252520build%25252520stage%25252520from%25252520above%2525250ACOPY%25252520--from%2525253Dbuild%25252520%2525252Fdocker-gs-ping%25252520%2525252Fdocker-gs-ping%2525250AEXPOSE%252525208080%2525250A%25252523%25252520user%25252520is%25252520specified%25252520as%25252520nonroot%25252520to%25252520optimize%25252520security%25252520as%25252520normally%25252520docker%25252520runs%25252520with%25252520root%25252520privileges%25252520which%25252520can%25252520access%25252520the%25252520kernel%25252520%2525250AUSER%25252520nonroot%2525253Anonroot%2525250AENTRYPOINT%25252520%2525255B%25252522%2525252Fdocker-gs-ping%25252522%2525255D&amp;image=https%3A%2F%2Fcarbon.now.sh%2Fstatic%2Fbrand%2Fbanner.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=carbon" width="1024" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/9a09e925909d1c5b2a72e0b6be7e9f00/href">https://medium.com/media/9a09e925909d1c5b2a72e0b6be7e9f00/href</a></iframe><h4>3. Minimize the number of Layers in your resultant docker image</h4><p>Each use of RUN, COPY, FROM in Dockerfile instructions adds a new layer and <strong>each layer adds to the build execution time &amp; increases the storage requirements of the image.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PJMcFmTx3aNvFeze3zgLcQ.png" /><figcaption>The arrow head points towards the 7 layers generated against the dockerfile code on the left.</figcaption></figure><p>Any ways to reduce the number of layers? Easy🥳 Let’s consolidate the RUN commands into a single layer. Let’s see how this changes the number of layers generated.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8VFY1N0juK_clKpFDYKD3A.png" /><figcaption>Only 3 layers generated against the updated dockerfile code on the left.</figcaption></figure><p>👍 [Pro Tip] Install ONLY the required packages.</p><p>Every Docker image consists of multiple packages that needs to be installed. These package usually take time to install and also add to the overall image size. As you can see in above code snippet, we have used the <strong>--no-install-recommends </strong>flag to disable recommended packages. Therefore its always best to only install the required packages.</p><h4>4. Sort multi-line arguments</h4><p>Sorting multi-line arguments alphanumerically helps to avoid duplication of packages and ensures that the list is much easier to update.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcarbon.now.sh%2Fembed%3Fbg%3Drgba%2528220%252C209%252C209%252C1%2529%26t%3Dsolarized%2Blight%26wt%3Dnone%26l%3Dauto%26width%3D984%26ds%3Dtrue%26dsyoff%3D20px%26dsblur%3D68px%26wc%3Dtrue%26wa%3Dfalse%26pv%3D56px%26ph%3D56px%26ln%3Dtrue%26fl%3D1%26fm%3DHack%26fs%3D14px%26lh%3D143%2525%26si%3Dfalse%26es%3D2x%26wm%3Dfalse%26code%3DRUN%252520apt-get%252520update%252520%252526%252526%252520apt-get%252520install%252520-y%252520%25255C%25250A%252520%252520%252520%252520aufs-tools%252520%25255C%25250A%252520%252520%252520%252520automake%252520%25255C%25250A%252520%252520%252520%252520build-essential%252520%25255C%25250A%252520%252520%252520%252520curl%252520%25255C%25250A%252520%252520%252520%252520dpkg-sig%252520%25255C%25250A%252520%252520%252520%252520libcap-dev%252520%25255C%25250A%252520%252520%252520%252520libsqlite3-dev%252520%25255C%25250A%252520%252520%252520%252520mercurial%252520%25255C%25250A%252520%252520%252520%252520reprepro%252520%25255C%25250A%252520%252520%252520%252520ruby1.9.1%252520%25255C%25250A%252520%252520%252520%252520ruby1.9.1-dev%252520%25255C%25250A%252520%252520%252520%252520s3cmd%25253D1.1.%252A%252520%25255C%25250A%252520%252526%252526%252520rm%252520-rf%252520%25252Fvar%25252Flib%25252Fapt%25252Flists%25252F%252A&amp;display_name=Carbon&amp;url=https%3A%2F%2Fcarbon.now.sh%2F%3Fbg%3Drgba%252528220%25252C209%25252C209%25252C1%252529%26t%3Dsolarized%2Blight%26wt%3Dnone%26l%3Dauto%26width%3D984%26ds%3Dtrue%26dsyoff%3D20px%26dsblur%3D68px%26wc%3Dtrue%26wa%3Dfalse%26pv%3D56px%26ph%3D56px%26ln%3Dtrue%26fl%3D1%26fm%3DHack%26fs%3D14px%26lh%3D143%252525%26si%3Dfalse%26es%3D2x%26wm%3Dfalse%26code%3DRUN%25252520apt-get%25252520update%25252520%25252526%25252526%25252520apt-get%25252520install%25252520-y%25252520%2525255C%2525250A%25252520%25252520%25252520%25252520aufs-tools%25252520%2525255C%2525250A%25252520%25252520%25252520%25252520automake%25252520%2525255C%2525250A%25252520%25252520%25252520%25252520build-essential%25252520%2525255C%2525250A%25252520%25252520%25252520%25252520curl%25252520%2525255C%2525250A%25252520%25252520%25252520%25252520dpkg-sig%25252520%2525255C%2525250A%25252520%25252520%25252520%25252520libcap-dev%25252520%2525255C%2525250A%25252520%25252520%25252520%25252520libsqlite3-dev%25252520%2525255C%2525250A%25252520%25252520%25252520%25252520mercurial%25252520%2525255C%2525250A%25252520%25252520%25252520%25252520reprepro%25252520%2525255C%2525250A%25252520%25252520%25252520%25252520ruby1.9.1%25252520%2525255C%2525250A%25252520%25252520%25252520%25252520ruby1.9.1-dev%25252520%2525255C%2525250A%25252520%25252520%25252520%25252520s3cmd%2525253D1.1.%25252A%25252520%2525255C%2525250A%25252520%25252526%25252526%25252520rm%25252520-rf%25252520%2525252Fvar%2525252Flib%2525252Fapt%2525252Flists%2525252F%25252A&amp;image=https%3A%2F%2Fcarbon.now.sh%2Fstatic%2Fbrand%2Fbanner.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=carbon" width="1024" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/a4b511b8647eb21029f6135da8ec0d1f/href">https://medium.com/media/a4b511b8647eb21029f6135da8ec0d1f/href</a></iframe><p>👍 [Pro Tip] Use a Linter such as <a href="https://marketplace.visualstudio.com/items?itemName=henriiik.docker-linter">Docker Linter</a> for Visual Studio. This will help you detect syntax errors in your Dockerfiles and gives you some suggestions based on common practices.</p><h4>5. Exclude with the use of .dockerignore file</h4><p>Use a .dockerignore file to <strong>exclude files not relevant to the build</strong> (without restructuring your source repository). This file works similar to .gitignore file. The .dockerignore file excludes the files and directories that match the patterns declared within it. This helps to <strong>avoid sending extremely large or sensitive files</strong> <strong>and directories</strong> to the daemon or adding them to public images which could pose a security risk.</p><h4>6. Some tools to help in image optimization</h4><p><strong>Dive</strong> is a go-based tool for exploring each layer in a docker image. To build your image and then analyze it, use dive build -t &lt;some-tag&gt; . To ensure you’re keeping wasted space to a minimum, run CI=true dive &lt;your-image&gt;in your CI pipeline.</p><p>Dive provides basic layer information and estimates the wasted space your image contains which might be from duplicating/moving files across layers or not fully removing files. Both a percentage “score” and total wasted file space is provided.</p><p>Another tool is<strong> Docker-squash</strong> which is a python-based tool for Docker image squashing. It can be installed using pip install docker-squash and used through docker-squash myAwesomeImage .This tool controls the structure of the final image by organizing the image in logical layers to avoid an image with multiple unnecessary layers.</p><p>Lastly, we have <strong>DockerSlim, </strong>a go-based tool<strong> </strong>that will optimize and secure your containers by understanding your application and what it needs using different analysis techniques. It will throw away what you don’t need and reduce the attack surface of your container.</p><p>Use docker-slim build &lt;image_name&gt; to analyze, profile and optimize your container image and docker-slim xray &lt;image_name&gt; if you want to know what makes your image fat.</p><h4>Conclusion</h4><p>To conclude, I would highly recommend trying out the tips mentioned above the next time you sit to write a dockerfile. I hope this article will help you to use docker smartly from the get go. Finally, if there are some other best practices that you use frequently, please comment below. Thanks for reading ! Have a great day 👋👋👋</p><p><a href="https://codencloudwithcoffee.squarespace.com/">https://codencloudwithcoffee.squarespace.com/</a></p><ul><li><a href="https://www.tutorialworks.com/why-use-containers/">Why use Containers?</a></li><li><a href="https://github.com/docker-slim/docker-slim#basic-usage-info">GitHub - docker-slim/docker-slim: DockerSlim (docker-slim): Don&#39;t change anything in your Docker container image and minify it by up to 30x (and for compiled languages even more) making it secure too! (free and open source)</a></li><li><a href="https://github.com/goldmann/docker-squash">GitHub - goldmann/docker-squash: Docker image squashing tool</a></li><li><a href="https://github.com/wagoodman/dive">GitHub - wagoodman/dive: A tool for exploring each layer in a docker image</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3ba4e25557fb" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>