Debian images can end up using a lot of apt-get tricks to install dependencies cleanly. Way easier with alpine. I think there are plenty of reasons people are quick to make this decision without the necessary depth of investigation.
Minimizing docker image size is great. Cold starts with large image downloads can cause all sorts of fun issues. Yes, if you're shipping lots of dependencies in your containers the size of the base image can quickly be irrelevant. And yes, I think it is usually reached for prematurely, but the benefits are there for the few that need them.
During development, it really does matter if my images are 4MB or 80MB.
Just like when compilation times and tests start growing in the minutes, my feedback cycle is broken.
I also compile Rust statically to musl, so I'll seriously consider building the final image on the device to avoid copying the base image during deployment. Or ditch Docker entirely.
When you create a new Docker image with a recompiled Rust binary, only the last Docker layer will need to be downloaded to the device. Incremental caching means Docker won't re-download the base layer. The last layer is basically the new binary itself. So I don't see how it would be slower than copying the raw binary. But maybe I'm missing something.
So just like when you change one c file you don't have to recompile the whole project, updating the last layer in the image should only require a few mb of transfer, the base layers would only be transfered once.
I don't think it is a premature optimization anymore, it has become the best practice by default. The network effect at work.
Unlike the early days of Docker, today you see popular distros provides multiple official image flavors depends on how minimal you are comfortable with. Or you can go even further with things like Google distroless, or even just scratch. I rarely see negative consequences when it's done appropriately. In fact, we see a lot of benefits by doing this. for instance, developers now understand their own app's dependencies much better ("oh your python app is having a cert error? does it come with its own cert bundle, use 3rd party package like certifi, ca-certificates from OS package manager, or a combination of some of them?" It's much easier to answer this question now than before)
Package only the stuff your app needs.
In most cases it's not even an optimization! Docker's layered caching means the most relevant size is the diff between the base image and the final image. This is generally independent of which base image you use.
It has a bunch of negative consequences like in this blog post.
It's something that many people new to Docker feel they should be doing, so you see it a lot.
Just an all-round great premature optimization.