Nix & Docker: Layer explicitly without duplicate packages! (nix2container)

Heyo,

I had some trouble understanding how to get duplication free explicit layers with nix2container, so I wrote a summary here to help others out:

https://blog.eigenvalue.net/2023-nix2container-everything-once/

Feel free to give me feedback on all levels:

  • Is there a better way?
  • Writing style etc.

Thank you :slight_smile:

5 Likes

Thanks for your post! It’s really nice to see people hacking with nix2container!

I like to have more control but maybe fully automatic is the best?

I think this manual method is especially valuable if you often rebuild your containers or if you build several containers simultaneously since common layers (bash, runtime environment, …) can be share between all images: when you update a common layer, it would be only built and pushed a single time.