7 ms·
Ask HN: What languages/ecosystems offer the smallest container sizes?
(Inspired by this: https://news.ycombinator.com/item?id=36653340 and Whartung's observation that Linux forums used to bring up packaging the run time.)
What languages can fit in the smallest container with a functioning e.g. echo server?
More interestingly: What's the smallest production container you've seen and how was it accomolished?
You can build scratch containers with just a Go binary, which packages the runtime in about 1.5MB, not much more for an echo server.
With Racket (a Lisp/Scheme) you'd need to package a minimal OS like Alpine Linux and then minimal Racket (without the IDE etc.), giving you about 80MB.
I don't know Rust, but I've seen some containers around 10MB in it. I expect they can get much smaller when not packing so much functionality.
A quick Google shows a toy C container under 1KB! [1]
What's rhe smallest you can do with the JVM? Or Nim, Zig etc.? Perhaps a Fortran or Ada container?
[1] https://blog.hypriot.com/post/build-smallest-possible-docker-image/
- sargstuff 3y ago0 byte container where network card hardwired to echo receiving information to serial line with screen attached & echoes display string back to sending IP. 8 bit iot application : https://en.wikipedia.org/wiki/Contiki https://en.wikipedia.org/wiki/Contiki
- gregjor 3y agoC, Rust, Go binaries are not containers, if you mean something like Docker. A VM is not a container either. You need to make a clearer distinction between compiled languages with no runtime (C), compiled languages with a runtime component (Go, Rust), languages that run in an interpreter with a runtime component (Python, Ruby, PHP), languages that run in a VM (Java, C#), and containers (Docker). You can run anything in a Docker container but you don't have to.
- nighmi 3y agoHow could I make that clearer? I explicitly asked about what language ecosystems offer the snallest production containers and gave examples.
- gregjor 3y agoSee this: https://tech-couch.com/post/producing-smaller-docker-images-for-go-applications https://tech-couch.com/post/producing-smaller-docker-images-... Techniques described would apply to any application language.
- gregjor 3y agoYour question was not clear to me because it conflates containers (Docker) with runtimes and VMs. No container at all will give the smallest production container, so a compiled language with no runtime (C) or one with a small runtime (Go) answers your question. If you must use containers for some reason, the container stuff (e.g. Docker) imposes a constant overhead regardless of the contents, so you can set that aside and just add up the size of the application binary plus runtime plus dependencies. C will likely come out at the top of the list, .NET and Java at the bottom.