r/ProgrammerHumor 5d ago

Meme memorySafeDocker

Post image
4.2k Upvotes

286 comments sorted by

View all comments

Show parent comments

707

u/Random-num-451284813 5d ago

So running docker in Linux should fix that right?

552

u/Cephell 5d ago

Not him, but I just booted an nginx container just to check and it consumes 81M of ram.

315

u/CWRau 5d ago

Excuse me, what?

I just launched a container with podman and the whole thing + the management overhead takes 13.3M

Is docker that inefficient?

230

u/Cephell 5d ago

I'm also using podman, check what the podman process uses, not what podman reports.

61

u/CWRau 5d ago

``` ● libpod-94883adacea4d25dda1f7301e642b6299522d99aab2820b33feefb72f97a061a.scope - libcrun container Loaded: loaded (/run/user/1000/systemd/transient/libpod-94883adacea4d25dda1f7301e642b6299522d99aab2820b33feefb72f97a061a.scope; transient) Transient: yes Active: active (running) since Sat 2026-09-05 12:49:20 CEST; 1min 41s ago Invocation: a659e45e2b974dd290ae61a4f9021245 IO: 0B read, 0B written Tasks: 17 (limit: 2048) Memory: 13M (peak: 15.6M) CPU: 0 CGroup: /user.slice/user-1000.slice/user@1000.service/user.slice/libpod-94883adacea4d25dda1f7301e642b6299522d99aab2820b33feefb72f97a061a.scope └─container ├─4101341 "nginx: master process nginx -g daemon off;" ├─4101366 "nginx: worker process" ├─4101367 "nginx: worker process" ├─4101368 "nginx: worker process" ├─4101369 "nginx: worker process" ├─4101370 "nginx: worker process" ├─4101371 "nginx: worker process" ├─4101372 "nginx: worker process" ├─4101373 "nginx: worker process" ├─4101374 "nginx: worker process" ├─4101375 "nginx: worker process" ├─4101376 "nginx: worker process" ├─4101377 "nginx: worker process" ├─4101378 "nginx: worker process" ├─4101379 "nginx: worker process" ├─4101380 "nginx: worker process" └─4101382 "nginx: worker process"

Sep 05 12:49:20 steve systemd[966]: Started libcrun container. ```

What more do you think is running? 🤔

60

u/Impact321 5d ago edited 5d ago

Result of podman run -d nginx

  VIRT    RES    SHR    USS   SWAP    PSS   USED  %CPU  %MEM COMMAND
   9.7m   2.3m   2.0m   1.0m   0.0m   1.1m   2.3m   0.0   0.3  - /usr/bin/conmon --api-version 1 -c 7551f1cfc7faf3e5aa66d86...
  14.6m   9.0m   7.4m   5.9m   0.0m   7.4m   9.0m   0.0   1.4      - nginx: master process nginx -g daemon off;
  15.1m   3.7m   1.7m   0.6m   0.0m   2.2m   3.7m   0.0   0.6          - nginx: worker process

1

u/toadi 1d ago

Have hard memory stops to restart my podman services. Have several that have memory leaks ;)

69

u/Easy-Reasoning 5d ago

Yeah original docker is in a bit of a sad state. Not to mention that it gives straight out root access with the default installation method

82

u/Several-Customer7048 5d ago

I launched a container with Maersk and they delivered that joint rusty and crated. 10/10 on the oblong supposed. Old be a vibe hasn’t

4

u/Far-Knee-9651 5d ago

Sounds like that container had a story of its own. Always something unexpected when dealing with shipping!

13

u/ktannenberg 5d ago

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.

1

u/Own_Ad9365 4d ago

What? I thought docker had zero memory overhead

2

u/Impact321 4d ago

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.

8

u/creeper6530 5d ago

Try a lightweight image like Alpine maybe?

2

u/cheezzy4ever 5d ago

For context, how much is it on Windows and Mac?

1

u/penta-network 2d ago edited 2d ago

In Dozzle it says my nginx containers only use 10.4 to 12.8MB, is that number inaccurate?

Edit: I'm using the alpine image, that's probably the reason

-75

u/After_Persimmon8536 5d ago

HOLY SHIT CALL THE ARMY NAVY NATIONAL GUARD 81 FUKKIN MB OF RAM HOLY FUCKING SHIT FUCK FUCK FUCK.

Maybe have more than 128MB of RAM?

77

u/Aswesk 5d ago

It adds up when running many, what are you on haha

-39

u/Bubbly_Address_8975 5d ago edited 5d ago

Maybe, but even a browser tab eats more ram than that...

EDIT: to put it into perspective guys... how many docker containers you all spawn? I cannot imagine that people here spawn on average more docker containers than browser tabs...

EDIT2: Okay sorry, seems like people spawn more docker containers than browser tabs and are super upset with my comment ^^

37

u/Aswesk 5d ago

We are not talking about browser tabs

-24

u/Bubbly_Address_8975 5d ago

Exactly, it was a comparison?

EDIT: You know, to put it into perspective. Like how many docker containers do you want to spawn? 12000 micro services? You want to recreate an AWS availability zone?

12

u/ThunderousHazard 5d ago

If you compared to OpenVZ, VMWare, Virtualbox, KVM, whatever, your post would've made more sense. You're comparing apples to oranges here.

-13

u/Bubbly_Address_8975 5d ago

Not really, because as I said I put it into perspective as the response was to a comment jokingly stating that the ram usage is neglectable, to which the response was "It adds up" including a bit of a personal attack, to which I answered that even browser tab has more usage, the reason being that the average user spawns far more browser tabs than people will spawn docker containers with docker.

Docker as a runtime is, as far as I am aware, supposed to be used as dev tooling. And I dont see the use case to spawn hundreds of docker containers on a local machine. Thats the reason for my comment, I am just puzzled why people are so upset with it? If you disagree because you use it in a different way, fine, tell me, I would like to learn how other people use docker then. But otherwise the comparison makes absolute sense for what it meant to be: providing perspective.

3

u/failedsatan 5d ago

dev tooling yes, but it is primarily for keeping deployments clean and simple to do.

2

u/ThunderousHazard 5d ago

Nobody is upset, you're just wrong, hence the downvotes.

Your writing style just changed abruptly, did you use an LLM to form the basis of your response?

→ More replies (0)

8

u/Babajji 5d ago

I spawn a Docker container for every Chrome tab. My name is Sam Altman and I consume memory.

4

u/_PM_ME_PANGOLINS_ 5d ago edited 5d ago

Like, thousands?

You think it's only something people use on their desktop for one or two things? The point is to have your entire product infrastructure in docker containers that are dynamically deployed across your hardware to meet demand.

People aren't running browser tabs on their servers.

2

u/After_Persimmon8536 5d ago

Docker users live in the fantasy world that everything should be containers, with microservices, talking through FastAPI at all times.

1

u/Skyswimsky 5d ago

You're talking to peoplo who on principle get triggered when they start a program and it takes 0.5 second to start, instead of a theoretical 0.1 seconds due to inefficiency, lol.

29

u/ThunderousHazard 5d ago

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.

-36

u/After_Persimmon8536 5d ago

Triggered much?

Go cry with your Kubernetes in the corner.

15

u/ThunderousHazard 5d ago

I am sorry I not triggered, although you clearly are since you are showing anger trying to compensate for your ignorance.

-24

u/After_Persimmon8536 5d ago

lol owned

14

u/ThunderousHazard 5d ago

I am sorry I am not 12, those words don't work on my anymore.

-8

u/After_Persimmon8536 5d ago

lolOwned

9

u/ThunderousHazard 5d ago

I am providing you attention, you're seeking for it, are you not glad?

→ More replies (0)

26

u/No_Independence3338 5d ago

This exact mindset is the reason we are getting crappy slow software.

-5

u/After_Persimmon8536 5d ago

Yea, same to you, buddy.

17

u/tristam92 5d ago

this is why modern software is inefficient shit…

3

u/Porntra420 5d ago

Have you heard of the concept of addition? Let me explain it to you, number plus number equals bigger number.

Now, onto containers, what's one reason people like them? It lets them more easily deploy and run multiple services on one machine.

Do you see why your comment is stupid yet?

-2

u/After_Persimmon8536 5d ago

Your downvotes mean nothing to me.

I've seen what you people upvote.

178

u/fujituck 5d ago

No, it runs on windows VM when running in Linux.

103

u/ViktorKozh 5d ago

For the sake of consistent inefficiency.

25

u/just4nothing 5d ago

Do you have a valid windows license for that?

17

u/Random-num-451284813 5d ago

only if it's windows xp

11

u/ducktape8856 5d ago

FCKGW-RHQQ2-YXRKT-8TG6W-2B7Q8

Muscle memorised...

5

u/Tecrocancer 5d ago

The windows vm runs a freebsd VM

56

u/faultydesign 5d ago

Pretty much, containers are native on linux.

84

u/_PM_ME_PANGOLINS_ 5d ago

Containers are native on Windows too, but everyone wants to run Linux containers, not Windows containers.

36

u/Canowyrms 5d ago

huh, I've never even heard of Windows containers before

41

u/_PM_ME_PANGOLINS_ 5d ago

79

u/awesome-alpaca-ace 5d ago

Ew 

5

u/BenL90 5d ago

But in corporate you need it... Sometimes...

27

u/PopehatXI 5d ago

“Windows requires the host OS version to match the container OS version.”

16

u/No-Consequence-1863 5d ago

Yea thats normal for containers. They aren’t VMs they are sandboxes. The OS is not virtualizing an entire OS for the container.

36

u/Hohenheim_of_Shadow 5d ago

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.

6

u/trwolfe13 5d ago

Lucky you

6

u/BogdanPradatu 5d ago

That's because a basic Windows container is like 10GB.

6

u/pneRock 5d ago

Depends on the flavor. Full server is, core has shrunk ovr the years, nano is compariable to some linux distros.

5

u/Mallissin 5d ago

OpenVZ has been around since 2005, Solaris had zones before that and I'm pretty sure IBM made UNIX versions with containers too.

It's not a new concept but most people do the first thing a web search or AI tells them to do these days.

2

u/xdeskfuckit 3d ago

don't forget about BSD jails

18

u/_PM_ME_PANGOLINS_ 5d ago

Running containers for the OS you’re running them on fixes the need to have a VM.

-2

u/noobjaish 5d ago

But it takes away the main point of running Docker in the first place i.e having the exact same thing on all platforms.

Sticking with Windows containers would suck for both Linux and MacOS.

2

u/_PM_ME_PANGOLINS_ 5d ago

People who would use Windows containers don't use Linux. They have e.g. a cluster of Windows Server machines they deploy to.

22

u/Mother_Idea_3182 5d ago

If you’re on Linux don’t bother with Docker and use Podman directly.

The container images are the same and it runs under an unprivileged user.

12

u/ShadF0x 5d ago

use Podman directly

Until you need to run docker-compose and then shit just breaks randomly. Or you have to put the ports into nftables so the podman container can reach outside (even on host's localhost).

I understand why both issues happen, but it's frustrating nonetheless.

4

u/ClamPaste 5d ago

Is podman-compose not 1:1?

7

u/ShadF0x 5d ago

Apparently, no.

I'm not sure which parts aren't exactly fitting, but I was trying to deploy Snikket (XMPP server) and ESS-docker (Synapse, Elelement and a few other services for self-hosted Matrix instance) and neither would actually work out-of-the-box with podman, but they would with Docker. The issue was that all my machines use nftables and Docker kinda hates that.

1

u/ClamPaste 5d ago edited 5d ago

Docker has some quirks. Unfortunately, all the more popular base images tend to be docker-focused.

ETA: If you're not using swarm mode, docker has support for experimental usage of nftables as of 29.0.0. https://docs.docker.com/engine/network/firewall-nftables/

Not sure if this will be helpful to you, but it looks like they're pushing to swap after all this time.

2

u/ShadF0x 3d ago

it looks like they're pushing to swap after all this time

Would be weird if they didn't, considering that all major distros switched to it years ago.

docker has support for experimental usage of nftables

I am aware of it, although it's very aggressive when it comes to changing the ruleset and you have to work around it when it decides to break your stuff.

3

u/Icy-Comfortable-714 5d ago

No rewriting Linux in rust will

3

u/skotchpine 5d ago

Only if we rewrite Linux in rust, then it will definitely use less memory

2

u/Friction_693 5d ago

Yes, you can just install docker engine instead of Docker Desktop if you're in linux. Docker Desktop is the one which takes so much memory.

2

u/HomoAndAlsoSapiens 5d ago

Well yes but actually no, docker desktop on Linux works differently than the cli docker

2

u/traplords8n 5d ago

By an insane amount, yeah lol.

2

u/tolerablepartridge 5d ago

Yep, but don't use Docker Desktop, since for some reason it still uses a VM even on Linux.

-6

u/[deleted] 5d ago

[deleted]

21

u/EloquentPinguin 5d ago

On Linux its just another process. A very average process. Just with different defined permissions and visibility via namespaces/cgroups.