7 ms·
I love efforts like this. The current state of containers where the dominant mentality is “shove everything possibly needed into a single image and treat it lik
by clanktron 2y ago
I love efforts like this. The current state of containers where the dominant mentality is “shove everything possibly needed into a single image and treat it like a black box” isn’t the best imo. Only put what’s necessary and nothing else, you don’t need a whole OS to run a single binary or script.
- Joker_vD 2y ago> Only put what’s necessary If this were that easy, chroot with PID isolation alone would be quite enough.
- lrvick 2y agoIt is that easy, at least on distros built for containers. Most stagex based containers are a single binary.
- exe34 2y agonix can generate images with exactly what's needed and nothing more.
- Joker_vD 2y agoEven for the programs that do something like dlopen("libcrypt.so.3")? Allow me to doubt that.
- exe34 2y agoin nix, you have to be explicit about bringing in something, like libcrypt. otherwise it'll just never be found. so if you can get it to work outside of docker, it's pretty simple to put it in docker with all the things that are needed but nothing else: https://nix.dev/tutorials/nixos/building-and-running-docker-images.html https://nix.dev/tutorials/nixos/building-and-running-docker-... https://www.bnikolic.co.uk/blog/python/nix/2023/03/23/nixpydocker.html https://www.bnikolic.co.uk/blog/python/nix/2023/03/23/nixpyd...
- Joker_vD 2y agoOkay, but how do you find out that this program may dynamically load libcrypt which it doesn't mention in its PT_DYNAMIC for some silly reason or another? Because if you already know that, then you just put "RUN apt install -y openssl" in your Dockerfile which is easy. It's finding out that you need to do that that's hard.
- exe34 2y agodoes that mean apt lives in your image? or is it just on the Dev side? nix lives on the Dev side, and your image is not polluted. the issue of people not documenting their dependencies is not addressed by nix, other than the fact that undocumented dependencies also won't "works on my machine", until it's resolved.
- poorlyknit 2y agoWell no, obviously. Nix has not solved the rice theorem. But you'll have this problem whether you're using BuildKit or Nix. Difference is with Nix the final image only contains your explicitly stated dependencies. I.e. no apt, no Python, no Perl, no cacerts unless you explicitly include them.
- KronisLV 2y ago> The current state of containers where the dominant mentality is “shove everything possibly needed into a single image and treat it like a black box” isn’t the best imo. I do something similar for my personal containers. I have a common Ubuntu base image, that I add a bunch of tools to, which I might need for debugging later and install apt updates to as a part of the build process and remove the apt cache (so instead of changing the base image all the time to a more recent one, I still have an up to date container, at the expense of some additional layers). Then, on top of that base image I have other specialized images, ones with Apache, some with JDK, some for .NET, Python, Node, Ruby etc., which I can then build my apps upon, while having a few useful tools in the container, as well as a bunch of shared layers that the nodes will be able to reuse. The only exceptions are images like PostgreSQL, MariaDB, SeaweedFS etc., which I just take from Docker Hub, usually the Bitnami variety: https://bitnami.com/stacks/containers https://bitnami.com/stacks/containers because I almost never need to connect to those or use them as base images, but rather just use them as connected services. Should enterprises do that? Probably not. It is, however, an immensely pleasant approach to things, that lets me not stress about optimization and just use what works for me.