<p>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.</p>
<p>I've dug into the image itself, and the largest directories are <code>/usr/lib</code>, <code>/usr/local</code> and <code>/usr/bin</code>. 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.</p>
<p>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</p>

CC BY-SA 4.0
2021-07-23T07:15:33.490Z
I am no Ruby expert, but you can check here, https://jpetazzo.github.io/2020/03/01/quest-minimal-docker-images-part-2, 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
CC BY-SA 4.0
2021-07-24T09:55:49.843Z
Thanks for that, I'll have a read through
PaReeOhNos
<docker><ruby-on-rails>
Reducing docker image size - /usr/lib, /usr/local and /usr/bin
PaReeOhNos
# Reducing docker image size - /usr/lib, /usr/local and /usr/bin

(Asked by: username_0 on 2021-07-22)

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

**Tags:** docker, ruby-on-rails

> **Comments:**
> **username_1**: I am no Ruby expert, but you can check here, https://jpetazzo.github.io/2020/03/01/quest-minimal-docker-images-part-2, 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.  
> **username_0**: Thanks for that, I'll have a read through  

---

## 0 answers

