 Hello everyone a very good morning to all of you So how is it going? Thank you so much everyone for coming. Thank you so much to my team and my friends also who are here to share me up Really grateful to all of you So today We are going to witness a magical act without the wizard's hat because the wizard You know has to travel 30 hours from India So the wizard is little jet lag and forgot his visit visit had at home, but never mind we are going to still see the act and As we can see the title of the talk is Undravelling the magical act of Dr. Slim minifying continued images. How many of you have heard about Dr. Slim? Wow great so Who is a magician for today? My name is Brithin Jay Sharma and I have been Contributor to Dr. Slim for about more than like Seven months now and as an open source contributor. I have been Involved with a lot of open source communities for more than two years now Introducing a little bit about myself. So currently I'm a student. I'm still a student I'm pursuing bachelor's in computer science engineering from Jesus Academy of Technical Education Noida. It's a small college in India. So from there I'll be graduating in August 2022 other than that. I am currently Like contributing to a lot of open source projects previously. I have been a Google summer of course scholar twice once with the cloud native computing foundation and Other than that with our TMS also open source summit Has mattered a lot to me because it has helped me begin with my open source journey in 2019 So today It's my first time that I'm speaking At the open source summit the last time when I attended it. I was an attendee so Introduction and all is done The background is set now Let's talk about the origin of this magical portion of this magic that we are going to see today So how does this journey begin begin? Let's go back to 2013 So as far as I remember I have I mean okay. It's kind of general knowledge But yeah Docker was introduced in 2013 if I'm not wrong, but Linux containers existed before that So what Docker did for Linux containers or for containers in general was what Apple did with smartphones So like smartphones existed before iPhone, but iPhone I mean Those who are not Apple fans may not agree with that but iPhones usually Made the user experience a little more better. So that's what Docker in a way We can if you want to take an analogy dead for the containers They enhance the user experience of course. That's great But people who use to work with production use cases often face two challenges What are the containers production ready and how and what were the major problems pin pain points in those? In understanding it so the two major pain points were that Are they secure? Are they performance optimized? Now this is something that was a problem to a lot of developers and to the developer who created Also face this challenge Created this project called locker slim. We are going to talk about that later how it was created, but yeah so what happened was that The Docker community organized a hackathon called Docker hack day in Seattle in 2015 So there a lot of projects were being made a lot of ideas were being discussed But one man was trying to solve a problem that most of the developers were facing but they were not Trying to think in that direction that how many fine containers Sizes itself can play a large role not only making your image size smaller but also making them more secure and That laid the foundation of Docker slim so Docker slim is Created by Kylie quest He I mean before talking about him and how he impacted my journey also Let's talk about that hackathon. So in that hackathon this tool was not only it won the first prize but it also won in the second prize in the global Pumbler category for that and This too was originated there and He himself called this why why I tried to take a magical kind of idea because he when he when he Produced this tool he called it the magical pill for securing and minifying your images. So That that that thing I saw a tweet seven or eight months back Which talked about this and that actually made me curious to learn about it and since then I have been involved with Docker slim community so Other than that he has mean like working with he has a lot of experience he I think worked with Cisco also previously and I Started my good when I remember that when I started learning Golang because mostly when you work with cloud native technologies or containers or Docker engine of you you need to know go if you are a contributor So when I started with my goal and journey I remember that I started with his blog 50 shades of Golang and I didn't know that this man was also the creator of Docker slim, so it was a funny Like title because it relates with other things also, but yeah, I love the blog and from that blog I learned a lot What sets Docker slim apart like why? Why docus? Because there are various other methods also where you can minify your images So like it all that depends on a particular image, but but it It it it can be said that for most of the container images It can minify your image by 30 x 30 factors So that's a huge, you know difference that can set apart your performance orderly performance it can increase the speed of your how how you are going to spin up your containers in your In a production environment Not only that you can analyze what's happening. What's happening and you can even talk to the Not only the Docker slim containers, but even the intermediate container that is created to minify the container That that's that's what we are going to discuss next How how how this magic happens before we move to the demo we need to know how this magic happens How how does this work? so not only that you can X-ray your images and Of course, it also builds security profiles like app and circle Thus it makes your applications even more secure and more optimized now. Let's talk about how Before we talk about what it does through the live demo. I mean Let's see if the demo gods will be with me because they weren't in the they weren't with me in the morning I was trying a lot. So I have a pre-recorded demo already But yeah, let's talk about how docker slim makes image Six smaller faster and more secure So if I am not going to the code walkthrough because code walkthrough would be another dog But if we go to docker slim code, they are two things one is the main docker slim binary and the other thing is sensor So it's the sensor which injects The monitoring the multiple Tracing tools in a temporary container that is created from the fat image. So suppose you have Like in this example, they have taken an engex image. So, yeah The input is a fat image. You have your large size image ready. It's okay. It's fine But what happens next is that docker slim creates a temporary container. So in that temporary container All the magic happens that it basically does in three steps You can call like it does the static analysis the static analysis is like it assesses and collects things which are not going to be used after being created later and It tries to abstract away from being Implemented of being later on carried Increasing just the weight of the container directly in that temporary container All the collection of intelligence happens what the static and the dynamic analysis After that what happens that It it it applies all your heuristics Like it finds your SSL certificates is detects whether they are shells and then it creates the uses report and make your slim image almost ready The for you know to see like whatever you had earlier It's going to be more optimized more slim, but it's still going to be functional It's not going to change anything that that that's going to ruin your application So that's that's how that's the beauty of this tool that it basically builds upon the top of the temporary container That's just that's main idea is to minify your image After that you have your output as a slim image and it can be used for the future container runs So that was a brief Overview how Docker Slim works how how it works internally Now I think we'll move to demo so just to Let me go to terminal Yeah, so I'll I'll go with the pre-recorded demo because there are some issues in my laptop like it wasn't Working some some problems. So thank you so much for understanding, but yeah Playing the demo we'll we'll be able to talk about more how and see it in action. So Let's see first of all, we'll see what What's the dose? It's a Docker image that we already had it's a no Docker image and As we can see the initial size is 432 MB Now what will happen is that now we are going to run the build command So the build command is the most used command that actually minifies that actually does the magic it also produces a security profile and extra command is used when you need to know the more detailed more heuristics about your Things stuff and now As you can see the application with the Docker slim tool is running. So by default HTTP probe is on However, if your application is not exposing ports You can of course like turn it off, but if for this application for for this use case we had to use it So now we are going to test the size of the new image the slim image that we have created. So if you look at it 14 MB So from 432 MB to 14 MB and having the same use case as you had earlier This is magical and that happened with that temporary container inside actually it Analyzed and collected all the information that you already have, but it's still taking up the size now so so this was a life, I will not call it alive, but a pre-coded live demo of how we minify Docker images and Now moving back to the slides Yeah, so These are the additional resources that we have if you want to do Let me do it the full screen. Yeah So these are some additional resources like if you want to contribute to Docker Slim C Oh one of the fundamental ideas behind all the open source projects that I have learned myself as a student is that if you Want something? You not only ask you can even contribute directly So I would love that you can you all join our community We are active on the squad. We have a GitHub repository a lot of things have to be done A lot of things are in the pipeline one of the things that are in pipeline is supporting Docker compose for this So We are looking forward for that Then we have our origin story that I just talked about today and and There are multiple blogs on how we usually reduce like not only node, but Python images and other thing and and That's mostly about How how how your use case is it can it it has a like let me show you the Docker Slim examples repository it has a lot of a lot of examples So yeah, so this link has a lot of examples like for from Java to node image to Python to Ruby To test out and and mostly they are just you we can do it with just make commands So because we have made we have Mostly scriptified them actually so it can be easily tested out by you and Other than that I Will say that here are various examples like depending upon What kind of image that you have these are examples of how many how by how many factors they have minified they were minified in the Example so like if you see the Ubuntu image that we saw it was minified by 30x Similarly, if it's it it was alpine so this was a smaller image in itself So even after minifying it was reduced to 34 MB, but but it's still better So these are the multiple examples to look out Other than that I think We are done with the most of the contents of the talk and I would love to like discuss with all of you If you have any questions if you have any any any suggestions for us How to improve and what to what ideas do you have what use cases do you have? To learn better to improve the performance of docker-slim also better. Thank you so much Sorry, can you please have it was not valuable? I Think they are giving you a mic. Thank you Will it generate any report to show us what exactly it removed to slim down the docker image? Yeah, you can actually talk about that using x-ray x-ray command so with the x-ray command you will have access to Whatever whatever has been removed what what what what it does how it minified in in fact you can even talk to your temporary containers With the there's a command for that. I think I remember let me show you Yeah, even even the temporary containers can be talked directly. So that's that's an interesting use case an interesting question. So When we talk about the site and we can even have the sidecar containers, which which can actually help you out not only Seeing what has happened, but also debugging the slim the slim the minified container. So This is available on the GitHub repo and we can check more about that But we are using the x-ray command you can you can opt you can understand The insights of what has happened the report as you were talking about. Thank you So I don't know a lot about Docker or Docker slim Containers are big. Okay, and if Docker slim can optimize that Why don't why doesn't everyone uses it? If it if it if it, you know optimizes the code if it reduces and does not make anything It is not necessary that containers are always big right it depends on your particular Docker file and what application that you are building right and whether it will serve your purpose or right and it also depends on on The security profile that you are trying to inject in your containers So it depends again on the use case, but it's it's being used and that's why it's a very popular project if you look at Even the stars it has more than 13,000 stars. So people are using it. However. Yeah, it depends again On what specific use case do you want to use? So if I am a developer and if I have like I personally used it for my goal and project and it minified my images 512 12 factor. So I use that but it again depends like what what the user and the developer experience is all about and mostly Who who doesn't love More slim image, right? So is there like a trade-off of minifying it? Do you lose any features or anything like that? Essentially not But at times you might need to talk and see what happens. That's why we have the sidecar facility to see What can we improve what what are we losing something that? Might be important to us and that's why talking we have this facility of talking to the temporary container as well as to the slim image Awesome. Thank you. Yeah Thank you so much for the talk. I just had one question. So coming into a more complex use case Like let's say you are building a microservices based architecture. So you might have multiple services Each having their separate images and you're using something like Docker compose up and in that you sort of specify within the ML file you specify which particular image needs to be invoked for example, you start by invoking your MongoDB Instance and then you invoke your back end and then your front end. So when you have such kind of a complex use case We have sort of defined in which way the images need to start booting up Is there any facility within Docker slim that sort of manages this or I mean, how does Docker slim take into consideration? Multi-mage approach or a project that has multiple images Right. So this is something that Not only an interesting question, but something that I will be working on very soon after my graduation So we are already actually working on it's a work in progress about the experimental Docker compose support and various Like like Docker compose support wasn't there in in its full form and it's not even there right now but yeah, it's a work in progress and very soon this complex use case that you talked about is actually One of Will be one of the brownie power points for people using the August limb So it's it's definitely an improvement that we will be working on and in fact, I have to be working on after a couple of months I guess I was going to ask is that on average how much manual effort is needed to exercise the container for? For software you write will be quite straightforward But for if you are taking existing commercial software and trying to run it through slim Have you found you need to do a lot of manual effort to make sure slim identifies all the required files Beg your pardon. I missed some I mean like I miss it It's the probe and probes the software to make sure it's exercises and it identifies the files That need to be that aren't used to be removed and I'm understanding the design right right and so for How much effort is that step in your experience to fully exercise software? Like it depends on how you start Using the August limb itself like if you are a if you have just started with that So sometimes the time of understanding the project because again, it's a developer oriented tool. So It's not end user or I guess that's what it's good to think soon as a developer oriented tool that answer makes sense But have you found it appropriate to use on existing commercial software existing containers that you didn't develop? Yeah like I like I haven't used myself directly, but I think so that some of my Colleagues might have worked and and they would have worked with that. So I'm not sure about that personally But yeah, it has been used in production use cases. I definitely one example that I have I think Nirmata Nirmata also uses is for Kyber no because I work I have worked with Kyber no so Kyber no Kyber no example is once such example, which which is being used in production use case Right. So one of the major plans that we have ahead is about introducing the Docker compose feature And the other thing that we are going to work is on that the HTTP probe right now. It works internally it talks internally to the You know the temporary container that's that's what we are going to, you know Not do that directly. We are we are going to use the traditional way of talking to HTTP API. So so that's what That that will not only help us Increase the current flow of Docker slim. That's how it's working, but it would also Help the experience of the SAS application. That's being built over. Yeah So that's that that they are the two major things that we can see Other than that, I think in the slim in the doc in the Docker desktop extension. It's all it's already there the slim.ai tool to To actually just, you know, don't even you don't even have to use those terminal commands just a click to minify your images Do we have virtual questions If you if you wish to connect with me Even post this talk anything like anything like you would like to talk about your we can we can connect on Twitter This is my Twitter handle and this is my email ID. So we definitely love to chat more about Open source engine or Docker simulator And if thank you so much to everyone for attending the talk