3 ms·
Unfortunately the result of a Nix Docker image is an image that is 100+ MB for no particular reason :(
by denysvitali 3y ago
Unfortunately the result of a Nix Docker image is an image that is 100+ MB for no particular reason :(
- TeeMassive 3y agoThere are ways to properly build a nix container image so this kind of things doesn't happen. You'll find plenty of projects on GitHub dedicated to only that.
- denysvitali 3y agoCan you please provide an example? Everything I've tried ended up being way bigger than I think it should
- l0b0 3y agoWhere on Earth are you getting that result from? [1] gives an 11 MB image. [1] https://nix.dev/tutorials/nixos/building-and-running-docker-images.html#build-your-first-container https://nix.dev/tutorials/nixos/building-and-running-docker-...
- denysvitali 3y agoFrom experience - but I'm more than happy to be proven wrong as I would love to build all the Docker images with Nix. What you linked is the equivalent of: FROM scratch COPY hello-world /hello-world Of course that's small (hello-world is statically linked). Try to add coreutils (or any other small package) and you'll see what I mean. In my experience the size of a Docker image built with some nix packages is greater than the Debian counterpart. I don't know why though.
- georgyo 3y agoNo, that dockerfile is not equivalent because the hello-world is not statically built in the nix version. However I'll give you that it could be smaller in more complex examples. For example glibcLocales is for all locales which is quite chunky but your application only needs one locale.