Closed davecoutts closed 6 years ago
Hello @davecoutts,
Thanks a lot for your contribution to the project, much appreciated!
Unfortunately, we can't easily remove gcc, dev libraries and python sources from the target image, because currently it can be needed to make offline Graphite installation if /opt/graphite
directory is mounted by docker and empty - https://github.com/graphite-project/docker-graphite-statsd/blob/master/conf/etc/my_init.d/01_conf_init.sh#L20-L22.
Probably you can copy whole /opt/graphite
somewhere and copy it back instead of installation in runtime, which is possible, but require some work - and it will probably consume space of final image too.
I have no big interest in the reducing Docker images' size per se, but, of course, I will gladly accept PR if it will not break too much of existing functionality of the image.
Hi @deniszh Oh I see. I hadn't appreciated the image had that functionality. The size optimisations I have applied will certainly break the setup where local volumes are mounts. I'm going to close this issue as what I have suggested is not appropriate in this case. Thanks.
Hi @davecoutts , I made similar PR using your idea, but using multistage build instead - https://github.com/graphite-project/docker-graphite-statsd/pull/56 Thanks!
Hi Denis
Good job. I like the multistage approach.
I came across dive the other day. It seems a very good tool for gauging image bloat. https://github.com/wagoodman/dive https://github.com/wagoodman/dive/releases
Your new image scores very well at 88% when tested with dive. sudo dive docker-graphite-statsd:latest
Regards
Dave
On Sat, 27 Oct 2018 at 23:13, Denis Zhdanov notifications@github.com wrote:
Hi @davecoutts https://github.com/davecoutts , I made similar PR using your idea, but using multistage build instead -
56 https://github.com/graphite-project/docker-graphite-statsd/pull/56
Thanks!
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/graphite-project/docker-graphite-statsd/issues/51#issuecomment-433659291, or mute the thread https://github.com/notifications/unsubscribe-auth/AAdj0hdMVAFSc_VPlnT7sR6Y-CYuFhrZks5upNqPgaJpZM4W1vIU .
Nice tool, thanks, @davecoutts !
I have done a little experimentation and it appears it is possible to reduce the size of the Docker image by 50%.
The size reduction is mostly achieved by,
The key thing to note with Docker is that once a RUN is complete nothing can be deleted from the resulting layer. Clean-up/deletion needs to happen in the RUN(layer) to be effective.
The Dockerfile below is less user friendly to read than the current published one. With the majority of the install work being done in one RUN. The size reduction might warrant that loss of readability.
I have only tested the resulting container briefly. I did nothing more than run the example events generator bash snippet and observe stats on a chart in graphite-web.
Might Docker Image size reduction following something similar to Dockerfile changes below be of interest to the project?