It's true for non-trivial cases, and exceptionally false for some things. Like databases. A lot of the sysctl tuning for large database environments has to be done on the host, either directly, allowing unsafe sysctls and restarting kubelet, running with privileges, etc.
This is not "independent of the underlying infrastructure" or "the VM and my laptop have the same kernel tunables set". They don't. And it matters.
Most applications don't.
And even if the application I work on does - then only in production. Not on my laptop. So on my laptop I will simply chose a docker image that resembles production as closesly as possible. I will not use a VM.
You’re probably right there’s a magnitude more tiny apps but who cares. A large number of us still are interested in and need to solve for non-trivial cases.
None of these are solved by "optimize kernel-parameters to the max".
Only when you don't need to store data for any length of time. The point of containers is that they don't store state. You have to manage that.
And for some cases you can get away with it. But for most websites, keeping a single container up for many years isn't a great strategy. (Yes, I know there are ways around this. but they are not as simple as "docker run postgres")
Vagrant used to be a thing and it would spin vms up pretty quick.
There are differences technically, between docker and vms, certainly, but conceptually they are the same, aren’t they?
There’s no real
I have not used a container today. Let's use one:
$ time docker run --rm debian:11-slim echo hello
hello
real 0m0.528s
user 0m0.015s
sys 0m0.023sAs a random example, Azure full-clones 127GB disk images by default. It takes over a minute to create a VM. Booting form a cold start is sluggish because there is no sharing with other tenants, hence no caching.
Using the same hypervisor (Hyper-V) I can clone out a Windows server VM and boot it in about 3 seconds by simply using delta cloning. Subsequent boots of it or any of its siblings is just over a second!
Containers and Kubernetes are throwing the gloves down and will force the competition to pick up the pace.
AWS EC2s start within a couple of tens of seconds max. AWS Lambda, Google Cloud Functions, Google Cloud Run start within ms (Google Cloud Functions used to have a cold start problem where sometimes they'd take up to a few seconds to start, but that has been fixed).
But overall, I'd say VM platforms are somewhat a thing of the past. Nobody cares about running an OS, what you need is the things inside (your application, database, etc.) so fundamentally a VM is an abstraction at the wrong layer, a means to an end. Don't get me wrong, they're still here and aren't going anywhere, but should no longer be the go-to outside of a few specific cases - bare metal, containers and "serverless" (running on bare metal) is where it's at.
The difference is my laptop doesn't provide any guarantees of stability, uptime or throughput.
installing a DB is as simple as "apt install $db"
> The nice thing about containers is that you are independent of the underlying infrastructure
I mean you're really not. You're dependent on the machine, the OS, and the kernel version. Docker on windows is a VM, from what I remember. I assume OSX's docker is still VM based too.
I can easily spin up a Docker container on my laptop. Takes a second or so.
Spinning up VirtualBox or something is so much more hassle.