I think the funniest part is that rewriting Docker in Rust does nothing to improve the memory safety of the workloads actually being run inside Docker containers, which is where most of the problems come from.
Docker is also dearly loved by people who otherwise can't get their 10000 Python dependencies working on anyone else's computer. Docker is to Python what Spring Boot is to Java.
On Win11 using WSL2 backend (I expect same results on Hyper-V backend directly; haven't tried new VMM backend yet) freshly launched nginx:latest is sitting at around 24-25 MiB on average across 40 containers. On Debian 12 they are around 13-14 MiB each.
With docker you usually have some management daemons such as dockerd and containerd and shims and such. Take a look at top -cem and press V for forest/tree view.
Are you sure you have the knowledge required to comment on this? How much RAM do you think is needed for that? My LXC debian instance for NGINX + OpenVPN + Firewall is even less, ~40MB.
To a large degree, so does Linux containers. Containers can only address the dependency issues statically linking libraries could. If your application is dependent on a specific kernel version, you can't run your container on a host with a different kernel version.
My system has 128GB RAM installed and by default an OS under WSL detects "only" 64GB. A colleague told me that it wouldn't go beyond that on its own and if I needed more, I'd have to tweak the configs. Never tried to see what would happen upon memory exhaustion, though.
There actually are native windows containers too and can use docker cli, docker engine etc. depending on config it can also run without a vm it can use process isolation and runs directly on the kernel .
I'm sure there are companies out there that use windows-based containers, but they are very much the minority. I didn't even know windows had it's own containerization untill last week
Two separate issues and the latter is not really true as well - WSL now supports native containers, there is no VM needed. Whether you call WSL a VM itself or not is a bit of a different story, it's a hypervisor - but it manages memory natively.
Two separate issues and the latter is not really true as well - WSL now supports native containers, there is no VM needed. Whether you call WSL a VM itself or not is a bit of a different story, it's a hypervisor - but it manages memory natively.
WSL is a hypervisor... that manages VMs. Running a linux container in WSL is just invisibly running a linux VM.
If a container is a linux container, it's relying on libraries and system calls made available by the host. They literally can't run without being in a VM running a linux kernel and having the linux dependencies.
The problem is far worse on Windows by anymeans. I have seen it qemu takes a 1-2 gigabyte extra but on Windows it has a lot of memory leaks bugs. After an year of struggling with trying to make docker work with wsl, I just gave up and have an all unixn setup.
Memory safety != memory leak safety. You can still leak memory, you can just be fairly sure there aren’t two people writing to the same variable at once.
Plus docker doesn’t eat memory, docker desktop does.
Problem is that many people see containers as light weight vms. But they are not. It is just some files with their own fs, process tree etc all running on host OS with just an illusion of being in their own separate OS. I hope i have understood it correctly...
I would just make one clarification that to my knowledge, Docker uses the host kernel, not necessarily the full OS. I'm just distinguishing that you can run an Ubuntu docker image on Redhat or something like that. Two different OS, same kernel
What you are describing is a lightweight VM. Having to duplicate your system files takes up additional resources, but having to run an entirely separate kernel does even more so.
Anyone with a lot of experience with this? I had mixed feelings, it felt slower at times for some reason, maybe network is handled differently. Then I ran into some weird issues, and I didn't know if it was a a difference between podman and docker, or just some anomaly so I gave up and switched back to docker engine.
Podman uses rootless containers with the current user's privileges by default, whereas docker runs everything under a single daemon that runs as root with full permission to access everything. Some things which work out of the box with docker don't work as easily with podman because of this but there are often workarounds that just take a bit of effort or configuration
I also don't use it, because everybody already has docker compose setups that assume docker and I got tired of fiddling with anything I wanted to run that I didn't write myself.
The biggest problem I’ve run into at work with it is that running containers seems to allocate some mystery disk usage that can’t be cleaned up except with either root or forcing Podman to remove everything: all containers, images, etc. Just stopping and removing things one at a time will not work.
How long ago did you try? In the days of red hat 7 it was dangerous. In 8 it was better but had bugs and missing features. Since 9 it’s been pretty solid.
yeah, I use it everyday running quadlets and multiple development containers and never had an issue. just remove the root assumptions and you're good to go
Memory safety (the only reason to use Rust) has nothing to do with memory usage, only memory leaks.
Docker doesn't significantly memory-leak.
And you cannot write something like Docker in a memory-safe way in any modern architecture - you'd just end up with a C->Rust conversion that is sprinkled with "unsafe" keywords everywhere.
True, but the number of ways Rust can leak memory is quite limited and well signposted compared to most languages. In safe rust, it's basically just Box::leak and loops of Arc/Rc pointers
Depending on your definitions of "leaks", I have managed to leak memory in java of all languages. It really isn't a thing a language can fix. (I did that when I implemented a cache and forgot to set its references to null when no longer used so while there wasn't any code that could ever reach this memory, there were pointers so that the gc wasn't allowed to clean it.)
Addressing the last paragraph, I strongly disagree. A Rust approach would define a narrow set of unsafe interfaces/functions, with safe wrappers. Those unsafe functions would be heavily heavily scrutinised and written with very narrow scope, maybe even formally proven to be safe, and so you could be much more confident of the memory safety of the program as whole.
No, the difference is that there is no language-level concept of memory safety in the parts of the code that use the safe abstraction, that is to say 99% of the codebase. Memory bugs could be anywhere in the codebase, rather than just in the 50 or so lines in unsafe blocks.
The analogy I always use is that it's a warning cone placed around the potentially dodgy parts. You could do that in C, manually or procedurally, we just don't.
The unsafe areas are STILL unsafe (hence the term), still need checking, and they can still affect surrounding "safe" code and the guarantees thereof (it's a myth to think that just because it's in an unsafe block, it will only ever affect the unsafe block!).
That's all it is - a warning cone. An automated one, sure, because you have to have it around any potentially-unsafe code, but you could do the same in C with any kind of static analysis or even preprocessor tool, or even just decent heuristics that you adhere to when coding. But it's not magic. It's just a warning cone.
Memory efficiency and memory safety are totally different and completely unrelated things. As long as you're coming from another systems programming language, rewriting something in Rust doesn't magically make it use less memory.
“If WASM+WASI existed in 2008, we wouldn't have needed to create Docker. That's how important it is. WebAssembly on the server is the future of computing. A standardized system interface was the missing link. Let's hope WASI is up to the task!”
I worked with wasm a bit back when i was doing an internship in Siemens. The project seemed really good. People working on it were passionate too. I don't know what happened and why it didn't make it to any big projects or frameworks.
As for my internship, I was mostly working on wasm runtimes for embedded systems but i think they decided that it was unnecessary and too in efficient for bare metal devices because they just wanted a plugin framework
Yeah, it all depends whether you need isolation + the need for portability, right?
If you don't need these qualities then obviously bare metal + compiled binaries will always be better and faster.
For our workflow engine r/Nyno (and our enterprise clients) we do need the isolation, and it seems WASM especially combined with WASI/custom hosts functions could really take us pretty far in that area.
Sorry you experienced this. The people I’ve interacted with from the community were helpful to me. And the technology is amazing. It’s the future of how we’ll use computers.
Am I crazy that I was testing stuff with docker for work on WSL Ubuntu? I mean I would never deploy it like that, but it was a fun test, couldnt get network going unfortunately.
I mean its why the windows version exists despite needing a whole ass VM for it, but it sucks to cross the file boundary between the VM and Windows and the network boundary, although doable
Yeah I did find out about that, but somehow it still wasn't working, Im very new to docker, and I mean I only have to use windows bc I cant have my workstation down for too long, next time I get some slow times ill likely get linux going, that should make it a bit simpler.
People always runnin shid in docker. Just another layer between my code and my MACHINE. I dont want to be closer to the metal. Like a MAN, I am the metal. The MACHINE and I are ONE
There can be. If the containerized application needs it’s own copies of system dependencies you wont get memory sharing of common dynamic libraries since the container will have it’s own copy in a layer separate from the OS version.
That's not really performance as much as it is overhead. There is of course some overhead, that's a trade you make for the management convenience and improved isolation.
It can be depending on the state of system memory and you will get a init-perf hit as lld will need to load those into memory upon start up of the application while if using the systems ones they would already be in the cache and just need the link ups. However do agree it's likely not an issue a user should worry about.
As for other points: bruh, u are putting wasm and desktop app together in a sentence about replacing docker tells me that you may not understand the way the solution is suggested
2.1k
u/Intrepid4444444 Sep 05 '26 •
Astra, write Docker in Rust. Make no mistakes.
You’re welcome
2.0k
u/No_Independence3338 Sep 05 '26
Rewriting won't fix the issue. Docker hogs memory in windows and mac because it needs a separate linux VM so containers can run on top of that.
71
u/Automatic-Boot665 Sep 05 '26
Memory safety != memory leak safety. You can still leak memory, you can just be fairly sure there aren’t two people writing to the same variable at once.
Plus docker doesn’t eat memory, docker desktop does.
246
u/minus_minus Sep 05 '26
Podman is right there.
112
u/HugoMNL Sep 05 '26
https://github.com/apple/container
77
u/ledow Sep 05 '26
Memory safety (the only reason to use Rust) has nothing to do with memory usage, only memory leaks.
Docker doesn't significantly memory-leak.
And you cannot write something like Docker in a memory-safe way in any modern architecture - you'd just end up with a C->Rust conversion that is sprinkled with "unsafe" keywords everywhere.
23
u/seweso Sep 05 '26
Who uses windows......and then blames docker for being bloated.
Use linux for a day.... with docker. And know thy enemy???
7
u/homer__simpsons Sep 05 '26
Not sure what is meant by "Docker" here as there are plenty of layers. But there is https://github.com/youki-dev/youki "A container runtime in Rust".
12
u/WeakCelery5000 Sep 05 '26
I can't believe how long docker has been around and how so many just don't freaking understand containers.
6
u/mpanase Sep 05 '26
Somebody explain to this pretend-engineer what Docker actually does under the hood
8
u/seweso Sep 05 '26
STOP USING WINDOWS???
4
u/Prawn1908 Sep 05 '26
Memory efficiency and memory safety are totally different and completely unrelated things. As long as you're coming from another systems programming language, rewriting something in Rust doesn't magically make it use less memory.
4
u/New_Salamander_4592 Sep 05 '26
finally, the 1 billion line commit will be legendary
4
u/theFirstHaruspex Sep 05 '26
I measure my career progress not by job titles, but by my ability to understand r/ProgrammerHumor posts
3
u/ImpossibleCreme Sep 05 '26
Orbstack
3
u/wjaz Sep 05 '26
Orbstack solved that problem for me. Or, significantly reduced it, anyway.
6
u/Outrageous-Machine-5 Sep 05 '26
Podman
5
u/EveYogaTech Sep 05 '26
WASM/WASI in the long-term. I think it's an actual quote from the Docker creator that if WASM/WASI was around, they wouldn't have created Docker.
2
u/Useful_Tie_1318 Sep 05 '26
I’ve been running Colima for a few years now and really like it
2
u/OkBeautiful4392 Sep 05 '26
Yes, please write docker in rust so the container for my nodejs app that already eats up 1GB of memory is more efficient
2
u/based5 Sep 05 '26
Nix fixes this
2
u/k-mcm Sep 05 '26
The remaining Golang fanatics burst into flames reading this.
2
u/Maskdask Sep 05 '26
Nix > Docker
2
u/AviaKing Sep 05 '26
When will people realize that languages are just tools and don't automagically fix problems lmao
1
u/Spooked_kitten Sep 05 '26
Am I crazy that I was testing stuff with docker for work on WSL Ubuntu? I mean I would never deploy it like that, but it was a fun test, couldnt get network going unfortunately.
1
u/FlashyTone3042 Sep 05 '26
That is right. It constantly freezes up my IDE
1
u/mostlikelylost Sep 05 '26
youki is already written in rust.
1
u/trenixjetix Sep 05 '26
podman
1
u/Kophey_cup Sep 06 '26
chroot
1
u/Nero8 Sep 06 '26
If you're on mac, I would give Orbstack a go.
1
u/yourMomsBackMuscles Sep 06 '26
People always runnin shid in docker. Just another layer between my code and my MACHINE. I dont want to be closer to the metal. Like a MAN, I am the metal. The MACHINE and I are ONE
1
u/Leifbron Sep 06 '26
Rust isn't better for memory consumption
It's equal at best
1
u/thegamer720x Sep 05 '26
Does it make sense to run docker irrespective of the stack you're using? Wouldn't running apps natively locally perform better?
0
u/paadam94 Sep 05 '26
Why would a different language fix that? So dumb
-4
u/piro4you Sep 05 '26
Just use WA. If you actually need corporate lvl software, that means that you have resources and means to create it. This means you should use WA.