Hacker News new | ask | show | jobs
by giobox 1319 days ago
"Docker Desktop" uses a VM for container execution on all supported OSes - Windows, macOS and Linux - default installs are not running "docker" natively at your local CLI if you are using "Docker Desktop" to run docker, even on Linux.

> https://www.docker.com/blog/the-magic-behind-the-scenes-of-d...

> https://docs.docker.com/desktop/install/linux-install/

> https://docs.docker.com/desktop/faqs/linuxfaqs/#what-is-the-...

"Docker Desktop on Linux runs a Virtual Machine (VM) so creates and uses a custom docker context desktop-linux on startup." I had previously assumed it would be native on Linux, but apparently not. To be clear, this only applies when talking about "Docker Desktop" installations - not the same thing as "docker" etc etc.

I also think the performance is pretty bad, and I've used it on all three OSes at one time or another. I simply never install "Docker Desktop" on Linux typically anyway - it adds so little value over a basic native local docker install there.

The only thing I think "Docker Desktop" is really great at is creating FUD regarding using the alternatives or even plain ole free "docker", but that is probably its primary means of generating revenue for the company - I've seen docker desktop licences get deployed everywhere recently, regardless of the merits. So many users I encounter don't even understand the distinction now between docker/docker-desktop, or that there is one.

3 comments

Running in a VM is there for very good reasons. If you look at where things are going to be installed on the base system, how you can reset the environment, how you deal with variations with other things installed on the host, and more. It's difficult to do this all well outside of a VM.

Also, there are many people who want that VM boundary. We found this when designing for Linux in Rancher Desktop and talking with people about it.

Interesting. What are they using to run the VM on Linux? QEMU? I looked through the article but didn't see that part explained.
On windows, docker desktop can use Hyper-V, but it also supports WSL2 as a backend.
The DD WSL2 backend is also creating a VM in Hyper-V. Actually, it's creating two VMs (docker-desktop and docker-desktop-data). It's also running a proxy in your WSL2 VM so you can access the docker server. It's all a bit convoluted TBH.

I actually decided today to stop using DD on my Windows machine and just run docker native inside the WSL2 VM instance instead. Still not sure what solution I'm going for on my Mac.

This is the way. It's even easier if you just winget install RedHat.Podman - that'll give you a tiny Fedora image where "docker" (podman) just works straight out of the box. No need to worry about getting iptables-legacy packages for your WSL distribution or whatever. It's so simple and lightweight, it feels like a much better solution than anything Docker ever did for Windows.
I do the same for the most part. I have the docker daemon setup both locally in Windows and also in WSL2. I then have multiple contexts setup in Windows so that I can easily switch between Windows/Linux containers from my host terminal. Thus far, I've not experienced any issues.

The initial setup was a little more complex than just running Docker Desktop, but since then, it's running flawlessly.

Talking about WSL2 in general: it creates one VM, with mount namespaces per "distro". That's why everything shares the same network (they didn't set up separate network namespaces). Also, the GUI support in Windows 11 is a separate mount namespace.
Well, yes, but it creates those when you log in. The proxy fixes some corp firewall issues (see other comments here). Start up is faster overall for me versus the normal backend.
> also supports WSL2 as a backend.

Also known as a VM, but maybe you get better warm up times. My main complaints are with the "docker desktop" app experience - not so much "docker" itself VM or otherwise. It adds so little to docker for the license cost too, at least so far.

https://learn.microsoft.com/en-us/windows/wsl/compare-versio...

You can simply install docker in a VM/WSL2 natively yourself and avoid docker desktop/licensing altogether. "Docker Desktop" is/was really a tool to simplify getting a Linux Kernel (the critical dependency for cross-platform container dev) on non-Linux platforms IMO, which seems wild to pay for to me in its current state and when Windows has a great built in VM via WSL2 anyway. That it even exists on Linux now (recent addition) is kinda amusing - on MacOS and Windows there is at least some argument to be made it simplifies getting the kernel...

The WSL2 backend is pretty broken from my experience, it will often lock up using 100% CPU after I put my laptop into sleep/hibernation, and the only reliable way to bring it back seems to be killing the VM in task manager and restarting. Dunno if this is Windows' fault or Docker's though.
Same here. I do not have admin rights on the machine so, unless I'm mistaken, I don't have any other option but to reboot.
Not broken for me fwiw on four different machines, one is ARM.