Top
Best
New

Posted by psxuaw 8 hours ago

Docker is weird(codeandcake.dev)
411 points | 196 commentspage 2
tyingq 8 hours ago|
Poke around in bocker[1]. For technical people, it makes the same points the article makes in a way that's very clear.

[1] "Docker implemented in around 100 lines of bash" https://github.com/p8952/bocker

DANmode 2 hours ago|
Bocker has a drastically smaller inherent software attack surface than mainline Docker, yet its container isolation is practically non-existent, making it way easier to exploit and break out of.
fbn79 1 hour ago||
I have recently discovered INCUS, very nice alternative to docker when a simple container is not sufficient https://linuxcontainers.org/incus/
fulafel 6 hours ago||
> I decided to make my own container runtime for fun [...] Unlike VMs, containers are just processes

Try to make your own VM runtime next, you might be surprised!

sreekanth850 5 hours ago||
I started hating Docker after seeing all the cargo culting on Reddit. Whenever someone asks about deploying an app on Linux, there's always at least one comment saying, Just use Docker. We finally ended up building our own deployment automation tool for our entire stack that doesn't use Docker at all.
eleventen 5 hours ago||
That comment invariably comes up because for most people it’s the objectively correct and most well supported option. If you’re asking redditors how to deploy something, you’re precisely the person docker is for.
steezeburger 4 hours ago||
Even when I'm not using Docker to deploy something, I'm _probably_ using oci images at the least, but I'm generally running my local dev stack with Docker compose. Not always, but I use it in a lot of projects.
gzapp 7 hours ago||
That part about the threading was a huge source of issues back in the early days. Goroutines could hop threads and it's the threads namespace/cgroup configuration that gets inherited when forking..

One of the gnarliest issues I recall was where network namespaces could occasionally not be cleaned up correctly. So "randomly" (but more likely under certain loads) the networking of a reused thread would get jacked and Docker could no longer pull images.

LambdaComplex 3 hours ago||
Plus Go's function for locking a goroutine to an OS thread was broken to the point where you could not safely rely on it for quite a while.
dboreham 6 hours ago||
Never, ever, ever, write your own userland threading library.

(rule broken by almost every language in common use, unfortunately)

eddythompson80 5 hours ago|||
That’s an absurd statement. Optimizing every language around what a runc-like program would need is absurd.
creata 6 hours ago|||
Where does this advice come from? Most web servers would use a lot more resources if they didn't use userland threading, wouldn't they?
gertop 5 hours ago||
I think you're confusing userland threading (also known as green threads) with a regular thread pool implementation (that uses regular OS threads).

Because most web servers use OS threads. Nginx, Apache, litespeed, they all spin up `core count` threads but they can all work single threaded just fine as well.

creata 4 hours ago||
No, I mean that Tokio, Go, etc., were built with general-purpose web servers in mind, and they decided that lightweight threads were necessary for that purpose because OS threads had too much overhead to be used per-request.

NGINX uses a state machine per task, which as far as I know is kind of what Rust's async functions end up desugaring to.

QGQBGdeZREunxLe 8 hours ago||
A good talk on the tech behind containers.

Containers From Scratch • Liz Rice • GOTO 2018

https://www.youtube.com/watch?v=8fi7uSYlOdc

andreygrehov 4 hours ago||
I created Range (for fun). No daemon. No root.

A few cool tricks:

`range shell python:3.12` - opens a shell image without pulling the entire image.

`range shell ubuntu --commands` - you are in Ubuntu. Type any command Ubuntu doesn't have and it comes from the image that has it. On the fly.

`range run --network none ubuntu` - network-isolated sandbox

range run ebs://snap-... -- cat /etc/os-release - opens an EBS snapshot with no EC2 instance

Another cool trick:

`range run python:3.12 --mount hf://moonshotai/Kimi-K2-Instruct:/model -- du -sh /model` says 959G instantly :)

Check it out here - https://getrange.sh

Most importantly, Range doesn't need any daemon, any container runtime, any registry or any image conversion. One binary only. On a Mac it boots its own tiny Linux VM per session, and on Linux it uses KVM.

andreygrehov 4 hours ago|
It also works with more than contaienr images - HuggingFace repos (hf://org/model), S3 (s3://bucket/...) or any HTTP server really.

Range always reads only the bytes your program touches. Nothing else. You can prob shell into a 1TB image from a Raspberry Pi :)

kazinator 6 hours ago||
> And if you know where to look, you can even find that process in /proc.

This is very important for debugging! Not just that process, but the processes running in that Docker can be found in /proc.

Why this is useful is that you can run gdb outside of that docker and point it to a process in the docker, including setting the file system root to the docker one, so that it gdb reads the correct objects from the correct paths, to get the right symbols and addresses.

asveikau 3 hours ago||
If you're old enough to remember some techniques that people used before docker (like chroot(2)-ing daemons for security), the "containers aren't real" observations are not really new info. When containers came on the scene it felt like an outgrowth or evolution of that technique, which was extremely crude and simple.
mcapodici 4 hours ago|
Docker question. Who prefers docker for local dev vs. run the thing directly. I usually prefer run the thing for debugging and hot reloading. Sure: build the containers and test them in CI. Dependencies like PG sure run in containers as they change less often and you save the install.
jlhawn 2 hours ago|
some people do all of their software development in a container. It really only works well if you are comfortable using TUIs instead of desktop apps though.
More comments...