docker-coala-base icon indicating copy to clipboard operation
docker-coala-base copied to clipboard

Reduce docker image layers

Open sils opened this issue 8 years ago • 15 comments

might help for https://github.com/coala/docker-coala-base/issues/55

sils avatar Dec 17 '16 21:12 sils

certainly makes pulling faster

sils avatar Dec 17 '16 21:12 sils

It can be done by merging some RUN instructions into one but it doesn't help that much since there's a one big image layer. I think it's when the distro is installing the dependencies. Changing into a smaller distro can make a significant change in terms of speed and size especially with that huge chunk but that's quite a huge route.

yukiisbored avatar Dec 19 '16 05:12 yukiisbored

What about an option of selecting only those bears which the user wants, according to my discussion with @sils we could make a web app which compiles a dockerimage of only those bears which the user wants. Also see these http://stackoverflow.com/questions/24482822/how-to-share-my-docker-image-without-using-the-docker-hub

arush0311 avatar Dec 19 '16 06:12 arush0311

We could use base image as the coala image with all bears installed and then remove all the bears which are not needed, hence also reducing the time to compile the image

arush0311 avatar Dec 19 '16 06:12 arush0311

but that increases the amount of image layers. Images in Docker are basically layers of changes that compiles into one docker image. And that also requires a server with a good amount of performance and bandwidth since some people just throw it in CI.

yukiisbored avatar Dec 19 '16 06:12 yukiisbored

@yukiisbored is there a way to remove what was added in previous layers? If that is not the case we will have to start with the base image (alpine?) and then install bears on top of it.

arush0311 avatar Dec 19 '16 06:12 arush0311

Perhaps we can calculate the shortest (installation) path between the previous images and the current image to be compiled and then use those steps.

arush0311 avatar Dec 19 '16 06:12 arush0311

@arush0311 as far as I know, nope. If it's possible, that'll increase the amount of layers anyway since it requires seperating installation commands

yukiisbored avatar Dec 19 '16 06:12 yukiisbored

@yukiisbored yes you are right :sweat: Perhaps will help with https://github.com/coala/docker-coala-base/issues/55 though.

arush0311 avatar Dec 19 '16 06:12 arush0311

@razvanch did some work in that direction which was merged, is this still needed? Looks ok to me.

sils avatar Jan 03 '17 21:01 sils

Reopen if you disagree :)

sils avatar Jan 03 '17 21:01 sils

Still lots of unnecessary layers.

jayvdb avatar Jan 03 '17 21:01 jayvdb

What about an option of selecting only those bears which the user wants

@yukiisbored found a nice tool which allows building a custom docker image by selecting a subset of components. @yukiisbored can you create a new issue about that.

jayvdb avatar Jan 18 '17 05:01 jayvdb

At https://github.com/coala/docker-coala-base/pull/119#issuecomment-282401596, @fneu suggested using one script for everything to reduce the layers.

With https://github.com/jayvdb/docker-coala-base/commit/3166a301b, I merged all the commands into a single RUN command, and the result is a 1Mb increase over master. While I doubt the increase is significant, or even unavoidable, it does indicate that it isnt an automatic win to collapse all of the layers.

jayvdb avatar Feb 26 '17 10:02 jayvdb

Unfortunate, but thanks for trying

fneu avatar Feb 26 '17 10:02 fneu