I'm trying to reduce the size of our docker image considerably, as it currently stands at ~1.13GB. Given our app codebase takes up ~300MB and the image is based on Alpine, I think it can be a lot smaller.

I've dug into the image itself, and the largest directories are /usr/lib, /usr/local and /usr/bin. I know that the app itself will have a number of dependencies so I'm sure a lot of these are required but what I'm hoping to find is a way of determining which ones are required, and which ones can be safely removed.

Our app is a Rails app, so hoping there's a way of getting info about these dependencies through bundler or something similar. Any advice would be amazing

  • I am no Ruby expert, but you can check here, jpetazzo.github.io/2020/03/01/…, for some ideas regarding docker images and interpreted languages. In the third part of that blog series, he explains how to use nixos to dramatically reduce docker image size, but the process can be a bit complex.
    – usuario
    Jul 23 at 7:15
  • Thanks for that, I'll have a read through
    – PaReeOhNos
    Jul 24 at 9:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.