Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the docker-desktop-data distro used for when running docker desktop with the WSL 2 engine

When running docker desktop on Windows with Hyper-V I have a single VM called DockerDesktopVM where my Linux VM is running with it's containers inside.

DockerDesktopVM

However when I run docker desktop with the WSL engine I see that it creates 2 WSL distros.

  1. docker-desktop
  2. docker-desktop-data

enter image description here

I can shell into the docker-desktop distro like I would any other distro.

enter image description here

But trying to do the same to docker-desktop-data just bounces me out.

enter image description here

So my question is what is the docker-desktop-data distro for and why does it exist separately from the docker-desktop distro? Clearly the name implies data but what specific data and why can't I jump into the distro as I would any other?

like image 946
Adam Cooper Avatar asked Apr 23 '20 21:04

Adam Cooper


People also ask

What is the Docker Desktop WSL distro?

Docker Desktop for Windows provides a development environment for building, shipping, and running dockerized apps. By enabling the WSL 2 based engine, you can run both Linux and Windows containers in Docker Desktop on the same machine.

Is Docker Desktop required for WSL?

WSL 2 also provides a mechanism for running Docker (with Linux containers) on your Windows machine. We'll install it as a prerequisite for Docker Desktop for Windows. If you're running Windows Home, WSL 2 is the only way to run Docker Desktop.

What is Docker Desktop used for?

Docker Desktop is an easy-to-install application for your Mac or Windows environment that enables you to build and share containerized applications and microservices.

What is the difference between WSL2 and Docker desktop?

Both your own WSL 2 distro and docker-desktop run on the same utility VM. They share the same Kernel, VFS cache etc. They just run in separate namespaces so that they have the illusion of running totally independently. Docker Desktop leverages that to handle bind mounts from a WSL 2 distro without involving any remote file sharing system.

Does Hyper-V create two WSL distros when running Docker desktop?

When running docker desktop on Windows with Hyper-V I have a single VM called DockerDesktopVM where my Linux VM is running with it's containers inside. However when I run docker desktop with the WSL engine I see that it creates 2 WSL distros. I can shell into the docker-desktop distro like I would any other distro.

What is the Docker desktop data distro?

The name is giving us a clue, the docker-desktop-data distro exists as a storage for images and configs, as well as the Kubernetes data store.

How do I enable WSL engine in Docker?

To enable the WSL engine, I just need to go to Settings -> General and turn on Enable the experimental WSL 2 based engine. Once I Apply & Restart docker will restart and my DockerDesktopVM will no longer be running.


1 Answers

The docker-desktop-data distro is used by the docker-desktop distro as the backing store for container images etc. When docker is run under Hyper-V the same result is achieved by mounting a VHD in the Hyper-V image but this isn't possible with WSL2.

To quote from the docker blog introducing the new wsl2 backend:

This will create 2 WSL distros for you:

Docker-desktop, which I’ll call the bootstrapping distro Docker-desktop-data, which I’ll call the data store distro 

From a high level perspective, the bootstrapping distro essentially replaces Hyper-V, while the data store distro replaces the VHD that we previously attached to the VM.

The bootstrapping distro creates a Linux namespace with its own root filesystem based on the same 2 iso files we mentioned earlier (not entirely true, but close enough), and use the data-store distro as the backing store for container images etc. instead of a VHD (WSL 2 does not allow us to attach additional VHD at the moment, so we leverage cross-distro mounts for that).

The blog post is a great introduction to how docker on wsl works.

like image 78
Adam Cooper Avatar answered Oct 28 '22 06:10

Adam Cooper