this post was submitted on 29 Aug 2025
525 points (99.1% liked)

Programmer Humor

27444 readers
1661 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 2 years ago
MODERATORS
 

Docker docs:

Docker routes container traffic in the nat table, which means that packets are diverted before it reaches the INPUT and OUTPUT chains that ufw uses. Packets are routed before the firewall rules can be applied, effectively ignoring your firewall configuration.

top 50 comments
sorted by: hot top controversial new old
[–] veganpizza69@lemmy.vg 120 points 2 months ago
[–] Static_Rocket@lemmy.world 102 points 2 months ago (3 children)

This was a large part of the reason I switched to rootless podman for everything

[–] False@lemmy.world 19 points 2 months ago (2 children)

Explicitly binding certain ports to the container has a similar effect, no?

[–] doughless@lemmy.world 8 points 2 months ago (4 children)

I still need to allow the ports in my firewall when using podman, even when I bind to 0.0.0.0.

load more comments (4 replies)
load more comments (1 replies)
[–] Kr4u7@discuss.tchncs.de 8 points 2 months ago (4 children)

My problem with podman is the incompatibility with portainer :(

Any recommendations?

[–] slate@sh.itjust.works 13 points 2 months ago (1 children)

CLI and Quadlet? /s but seriously, that's what I use lol

[–] chunkystyles@sopuli.xyz 5 points 2 months ago

Quadlets are so nice.

[–] giacomo@lemmy.dbzer0.com 12 points 2 months ago (1 children)

cockpit has a podman/container extension you might like.

[–] qaz@lemmy.world 6 points 2 months ago* (last edited 2 months ago) (1 children)

It's okay for simple things, but too simple for anything beyond that, IMO. One important issue is that unlike with Portainer you can't edit the container in any way without deleting it and configuring it again, which is quite annoying if you just want to change 1 environment variable (GH Issue). Perhaps they will add a quadlet config tool to cockpit sometime in the future.

[–] giacomo@lemmy.dbzer0.com 6 points 2 months ago

i mean, you can just redeploy the container with the updated variable. thats kinda how they work.

load more comments (2 replies)
[–] pizza_the_hutt@sh.itjust.works 7 points 2 months ago

This is the way.

[–] dangling_cat@piefed.blahaj.zone 36 points 2 months ago (2 children)

I DIDNT KNOW THAT! WOW, this puts “not to use network_mode: host” another level.

[–] exu@feditown.com 15 points 2 months ago (1 children)

network: host gives the container basically full access to any port it wants. But even with other network modes you need to be careful, as any -p <external port>:<container port> creates the appropriate firewall rule automatically.

load more comments (1 replies)
load more comments (1 replies)
[–] dohpaz42@lemmy.world 33 points 2 months ago (3 children)

It’s my understanding that docker uses a lot of fuckery and hackery to do what they do. And IME they don’t seem to care if it breaks things.

[–] marcos@lemmy.world 31 points 2 months ago

To be fair, the largest problem here is that it presents itself as the kind of isolation that would respect firewall rules, not that they don't respect them.

People wouldn't make the same mistake in NixOS, despite it doing exactly the same.

load more comments (2 replies)
[–] grrgyle@slrpnk.net 25 points 2 months ago (1 children)

If I had a nickel for every database I've lost because I let docker broadcast its port on 0.0.0.0 I'd have about 35¢

[–] MangoPenguin@lemmy.blahaj.zone 9 points 2 months ago (8 children)

How though? A database in Docker generally doesn't need any exposed ports, which means no ports open in UFW either.

load more comments (8 replies)
[–] salacious_coaster@infosec.pub 18 points 2 months ago (5 children)

My impression from a recent crash course on Docker is that it got popular because it allows script kiddies to spin up services very fast without knowing how they work.

OWASP was like "you can follow these thirty steps to make Docker secure, or just run Podman instead." https://cheatsheetseries.owasp.org/cheatsheets/Docker_Security_Cheat_Sheet.html

[–] domi@lemmy.secnd.me 45 points 2 months ago

My impression from a recent crash course on Docker is that it got popular because it allows script kiddies to spin up services very fast without knowing how they work.

That's only a side effect. It mainly got popular because it is very easy for developers to ship a single image that just works instead of packaging for various different operating systems with users reporting issues that cannot be reproduced.

[–] null_dot@lemmy.dbzer0.com 32 points 2 months ago

I dont really understand the problem with that?

Everyone is a script kiddy outside of their specific domain.

I may know loads about python but nothing about database management or proxies or Linux. If docker can abstract a lot of the complexities away and present a unified way you configure and manage them, where's the bad?

[–] LordKitsuna@lemmy.world 15 points 2 months ago

That is definitely one of the crowds but there are also people like me that just are sick and tired of dealing with python, node, ruby depends. The install process for services has only continued to become increasingly more convoluted over the years. And then you show me an option where I can literally just slap down a compose.yml and hit "docker compose up - d" and be done? Fuck yeah I'm using that

[–] MangoPenguin@lemmy.blahaj.zone 11 points 2 months ago

No it's popular because it allows people/companies to run things without needing to deal with updates and dependencies manually

load more comments (1 replies)
[–] steventhedev@lemmy.world 17 points 2 months ago

You're forgetting the part where they had an option to disable this fuckery, and then proceeded to move it twice - exposing containers to everyone by default.

I had to clean up compromised services twice because of it.

[–] ohshit604@sh.itjust.works 16 points 2 months ago (6 children)

This post inspired me to try podman, after it pulled all the images it needed my Proxmox VM died, VM won’t boot cause disk is now full. It’s currently 10pm, tonight’s going to suck.

load more comments (6 replies)
[–] MangoPenguin@lemmy.blahaj.zone 16 points 2 months ago

This only happens if you essentially tell docker "I want this app to listen on 0.0.0.0:80"

If you don't do that, then it doesn't punch a hole through UFW either.

[–] MnemonicBump@lemmy.dbzer0.com 16 points 2 months ago

This is why I install on bare metal, baby!

[–] MasterNerd@lemmy.zip 12 points 2 months ago (6 children)

I mean if you're hosting anything publicly, you really should have a dedicated firewall

load more comments (6 replies)
[–] Harbinger01173430@lemmy.world 11 points 2 months ago (1 children)

Nat is not security.

Keep that in mind.

It's just a crutch ipv4 has to use because it's not as powerful as the almighty ipv6

load more comments (1 replies)
[–] jwt@programming.dev 10 points 2 months ago (2 children)

Somehow I think that's on ufw not docker. A firewall shouldn't depend on applications playing by their rules.

[–] qaz@lemmy.world 17 points 2 months ago (3 children)

ufw just manages iptables rules, if docker overrides those it's on them IMO

[–] jwt@programming.dev 9 points 2 months ago (2 children)

Feels weird that an application is allowed to override iptables though. I get that when it's installed with root everything's off the table, but still....

[–] MangoPenguin@lemmy.blahaj.zone 5 points 2 months ago (2 children)

Linux lets you do whatever you want and that's a side effect of it, there's nothing preventing an app from messing with things it shouldn't.

load more comments (2 replies)
load more comments (1 replies)
[–] null_dot@lemmy.dbzer0.com 6 points 2 months ago

Not really.

Both docker and ufw edit iptables rules.

If you instruct docker to expose a port, it will do so.

If you instruct ufw to block a port, it will only do so if you haven't explicitly exposed that port in docker.

Its a common gotcha but it's not really a shortcoming of docker.

load more comments (1 replies)
[–] IsoKiero@sopuli.xyz 7 points 2 months ago

Docker spesifically creates rules for itself which are by default open to everyone. UFW (and underlying eftables/iptables) just does as it's told by the system root (via docker). I can't really blame the system when it does what it's told to do and it's been administrators job to manage that in a reasonable way since forever.

And (not related to linux or docker in any way) there's still big commercial software which highly paid consultants install and the very first thing they do is to turn the firewall off....

[–] stupidcasey@lemmy.world 10 points 2 months ago

On windows (coughing)

[–] jbk@discuss.tchncs.de 9 points 2 months ago

rootless podman and sockets ❤️

[–] skuzz@discuss.tchncs.de 9 points 2 months ago (1 children)

For all the raving about podman, it's dumb too. I've seen multiple container networks stupidly route traffic across each other when they shouldn't. Yay services kept running, but it defeats the purpose. Networking should be so hard that it doesn't work unless it is configured correctly.

[–] Diplomjodler3@lemmy.world 18 points 2 months ago (2 children)

Or maybe it should be easy to configure correctly?

load more comments (2 replies)
[–] iamroot@discuss.tchncs.de 8 points 2 months ago (1 children)

We use Firewalld integration with Docker instead due to issues with UFW. Didn't face any major issues with it.

[–] qaz@lemmy.world 5 points 2 months ago

I also ended up using firewalld and it mostly worked, although I first had to change some zone configs.

[–] cadekat@pawb.social 7 points 2 months ago (1 children)

I've been playing with systemd-nspawn for my containers recently, and I've been enjoying it!

[–] kurikai@lemmy.world 5 points 2 months ago (2 children)
load more comments (2 replies)
[–] m33@lemmy.zip 5 points 2 months ago

Docker does not play fair, does not play nice. It’s a dozer that plow through everything for devops that yolo and rush to production.

load more comments
view more: next ›