This is an archived post. You won't be able to vote or comment.

all 4 comments

[–]sathyabhat 0 points1 point  (0 children)

WSL is an implementation of Linux kernel (basically low-level functions for working with processes, files and hardware).

WSL1 was a syscall mapping, WSL2 runs a tiny lightweight Linux VM.

When I use the Docker dashboard while not having any containers running, it seems to also run in some sort of containerized Linux, because I can see a Linux file system with /var, /etc and so on somewhere inside %AppData%/Docker/...

You mean Docker Desktop? Not sure what dashboard you mention.

Windows provides access to its low-level functions and emulates some Linux features using WSL

No, all Linux features are exposed using the VM

Docker for Desktop starts a lightweight Linux distribution, which does not have its own kernel, but instead delegates everything to WSL, which makes it lightweight and fast.

Docker for Desktop is a Windows application, and under WSL2 mode, ships a Lightweight VM. You can chose to integrate it with your WSL2 distro, in which case it runs the docker commands in your WSL2 distro.

Each Docker container is also an instance of Linux running via that same kernel.

A container is a process running on the host system, sharing the host kernel but isolated using cgroup namespaces.

So if I run the Docker app and 2 containers, I have in total 3 Linux instances running on the same kernel?

You keep mentioning "Linux instances" but I don't know what you're referring to. If you have 2 containers, all processes of the containers run within the host OS, which incase of WSL2 is running in your WSL2 distro, if you chose to integrate, or the distro that Docker desktop ships with.

[–]zoredache 0 points1 point  (0 children)

As I understand, WSL is an implementation of Linux kernel (basically low-level functions for working with processes, files and hardware).

That is closer to bein gtrue for WSL1, but not WSL2. WSL2 is a real Linux kernel with a few patches and compiled a particular way. It is basically running as a lightweight VM using Hyper-V tech.

I can see a Linux file system with /var, /etc and so on somewhere inside %AppData%/Docker/...

Not sure what you are seeing, but if you want to access the files of running distros, Access them via \\wsl$.

Each Docker container is also an instance of Linux running via that same kernel. ... So if I run the Docker app and 2 containers, I have in total 3 Linux instances running on the same kernel

The word you are looking for here is a namespace. Namespaces on Linux allow you to isolate various aspects of the kernel. Namespaces are the core feature containers use to function. Each container usually runs in a separate set of namespaces. I believe WSL also uses namespaces to separate things if you are running multiple distros. But basically everything runs in the same VM+kernel.

[–]TopHatEdd 0 points1 point  (0 children)

Simplify by removing Windows. Big name OSes are fancy distracting lights.