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


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

Feel free to give me feedback on all levels:

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

Thank you :slight_smile:


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.