<p>We have a lot docker images that we need to upload to k8s, it works however when we start a new node this process can take a lot of time.</p>

<p>We try to change the images to use  "multi-stage" builds however still this process take a lot of time and we didn't saw significant change on the start time on new node.</p>

<p>Now we try the following: (however we not sure how much impact we will see ...) </p>

<ol>
<li><p>Try (as much as we can) to use the <strong>same docker images</strong> <code>from</code> , example all the images
which use alpine to use the exact same version (3.11) and not some of using version <code>3.10</code> and some <code>3.10.1</code> and some <code>3.11</code> etc , this will prevent the reuse mechanism of docker to layers that already cashed ...</p></li>
<li><p>Reduce the layers numbers , with combining the <code>RUN</code> commands to one instead of many.(we need to do it for many docker files...) , not sure how docker mechanism will help here to achieve our goals </p></li>
</ol>

<p>All this process to change both of using the same version and reduce layers can take a lot of time to do, are we are wasting our time or there or this is something that can reduce the load time ? is there any other idea which may help us ? </p>

<p>We have many docker images based on Golang, NodeJS, java, etc.</p>

Beno Odr
<p>so you are on the correct track</p>

<ul>
<li>use minimum layer</li>
<li>reuse layers</li>
<li>use same from tag to cache layers</li>
<li>use alpine or slim images</li>
<li>use multi-stage build </li>
</ul>

<p>I think you can not reduce size further. Just try <a href="https://github.com/jwilder/docker-squash" rel="noreferrer">docker squash</a> but this will not help much. </p>

<p>So how you can boot your nodes faster? </p>

<ul>
<li>is it possible to bake node image with the required image layers inside it?</li>
<li>is it possible to set up a docker registry next to your nodes? so that it will pull image faster without network lags</li>
<li>is it possible to keep libraries outside image and mount libraries at runtime? (eg. if your code is nodejs code, keep npm's outside of the container and mount npms directory at runtime)</li>
<li>k8s can run other than docker images. like <a href="https://cri-o.io/" rel="noreferrer">cri-o</a>. is it possible for you to build cri-o images? they are lightweight. </li>
</ul>
