this post was submitted on 24 Nov 2023
883 points (97.9% liked)

Programmer Humor

19522 readers
293 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 1 year ago
MODERATORS
 
all 29 comments
sorted by: hot top controversial new old
[–] angelsomething@lemmy.one 80 points 11 months ago (4 children)

Literally why docker was invented

[–] SpeakinTelnet@sh.itjust.works 42 points 11 months ago (2 children)

I have a love/hate relationship with docker. On one side it's convenient to have a single line start for your services. On the other side as a self-hoster it made some developers rely only on docker meaning that deploying the stack from source is just an undocumented mess.

Also following the log4j vulnerability I tend to prioritize building from source as some docker package were updated far later than the source code was.

[–] Zikeji@programming.dev 16 points 11 months ago (1 children)

The Dockerfile is essentially the instructions for deploying from scratch. Sure, they most likely only exist for one distro but adapting isn't a huge chore.

You can also clone the repo and build the container yourself. If you want to update say, log4j, and then attempt to build it, that's still entirely possible and easier than from scratch considering the build environment is consistent.

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

If I'm updating the source code already I might as well build my service from it, I really don't see how building a docker container afterward makes it easier considering the update can also break compatibility with the docker environment.

Also adapting can be a pita when the package is built around a really specific environment. Like if I see that the dockerfile installs a MySQL database can I instead connect it to my PostgreSQL database or is it completely not compatible? That's not really something the dockerfile would tell me.

[–] evranch@lemmy.ca 1 points 11 months ago

I really don't see how building a docker container afterward makes it easier

What it's supposed to make easier is both sandboxing and reuse / deployment. For example, Docker + Traefik makes some tasks so incredibly easy and secure compared to running them on bare metal. Or if you need to spin up multiple instances, they can be created and destroyed in seconds. Without the container, this just isn't feasible.

The dockerfile uses MySQL because it works. If you want to know if the core service works with PostgreSQL, that's not really on the guy who wrote the dockerfile, that's on the application maintainer. Read the docs, do some testing, create your own container using its own PostgreSQL or connecting to an external database if that suits your needs better.

Once again the flexibility of bind mounts means you could often drop that external database right on top of the one in the container. That's the real beauty of Docker IMO, being able to slot the containers into your system seamlessly due to the mount system.

adapting can be a pita when the package is built around a really specific environment

That's the great thing about Docker, it lets you bring that really specific environment anywhere and in an incredibly lightweight manner compared to the old days of heavyweight VMs. I've even got Docker containers running on a Raspberry Pi B+ that otherwise is so old that it would be nearly impossible to install the libraries required to run modern software.

[–] kratoz29@lemm.ee 2 points 11 months ago

I love Docker because it is the only sane method to selfhost shit with my Synology NAS, and I love my Synology NAS because it is the only Linux interaction that I have (from my old MacBook Pro).

[–] takeda@lemmy.world 19 points 11 months ago* (last edited 11 months ago) (1 children)

Yeah, it "solved" the "it works on my machine" by bundling the machine with the code.

https://youtu.be/0uixRE8xlbY

[–] Opafi@feddit.de 7 points 11 months ago (1 children)

Man, I really was interested in that topic, but that guy really can't do talks.

[–] takeda@lemmy.world 1 points 11 months ago* (last edited 11 months ago)

What about this? https://youtu.be/5XY3K8DH55M

Also I created this repo to create a reproducible sec environment for myself. I added other languages, but personally work mostly with python. It is basically resonating for handling all the boiler plate:

https://github.com/takeda/nix-cde

For packaging in docker I started to use nix2container project as it gives me a greater control over layers. So for example when I package my phyton app I typically use 3 layers:

  • python and it's dependencies
  • my application dependencies
  • my application, which is very tiny compared to other two, so there is great reuse of the layers

The algorithm mentioned in the video also helps a lot with reuse, but the above is more optimized by frequency of how things typically change.

BTW: today I discovered this https://github.com/astro/microvm.nix I haven't play with it yet, but in theory it would let me generate a microvm image (in similar fashion to generate a docker container) which would let me to run my app natively as a tiny VM on EC2 for example, and use only minimum necessary of a typical OS to run it.

[–] ohlaph@lemmy.world 5 points 11 months ago

Docker has been a savior.

[–] kurwa@lemmy.world 1 points 11 months ago (1 children)

Now we just need to run docker inside the browser

[–] eatyourglory@feddit.it 1 points 11 months ago

Ah-ah! Now that’s progress!

[–] Fades@lemmy.world 20 points 11 months ago (4 children)

Every time I hear this from one of my devs under me I get a little more angry. Such a meaningless statement, what are you gonna do, hand your pc to the fucking customer?

[–] platypode@sh.itjust.works 23 points 11 months ago* (last edited 11 months ago) (1 children)

doesn't understand that this is a useful first step in debugging

reacts with anger when devs don't magically have an instant fix to a vague bug

Yep, that's a manager

[–] Belzebubulubu@mujico.org 3 points 11 months ago

You are seeing the next CEO of that company

[–] Baizey@feddit.dk 18 points 11 months ago

...yes? I thought we made that clear with containerization

[–] 1984@lemmy.today 3 points 11 months ago

"my devs under me"

Lols.

[–] amanaftermidnight@lemmy.world 19 points 11 months ago (1 children)

Then we'll ship the AI.

...what do you mean, all the ICBM silo doors are opening?

[–] hakunawazo@lemmy.world 1 points 11 months ago

ChatGPT is far too long, let's call it WOPR. The most capable tic tac toe machine.
https://en.wikipedia.org/wiki/WarGames

[–] clearleaf@sh.itjust.works 13 points 11 months ago

They did it! They passed the turing test!

[–] takeda@lemmy.world 13 points 11 months ago (1 children)

But it doesn't even compile!

[–] Kolanaki@yiffit.net 18 points 11 months ago (1 children)

"You literally just wrote 'kill all humans' and put it in curly brackets."

[–] xmunk@sh.itjust.works 4 points 11 months ago (1 children)

"So, did your program fail after you executed it? Or do you just think my code looks wrong?"

[–] kamenlady@lemmy.world 4 points 11 months ago

If you keep inquiring like this, it will send the terminator personally to have you exterminated

[–] xx3rawr@sh.itjust.works 8 points 11 months ago

The AI is taking over us

[–] FaceDeer@kbin.social 0 points 11 months ago (1 children)

To be fair, the bug report was utterly useless too.

[–] Contend6248@feddit.de 0 points 11 months ago* (last edited 11 months ago) (1 children)

True, when i respond with the exact problem it usually gets fixed, interestingly even explained why it failed.

Great for learning

[–] IzzyScissor@lemmy.world 1 points 11 months ago

The only problem is that it'll ALSO agree if you suggest the wrong problem.

"Hey, shouldn't you have to fleem the snort so it can be repurposed for later use?"

You are correct. Fleeming the snort is necessary for repurposing for later use. Here is the updated code: