

- #Docker desktop keep ports from changing on reboot install
- #Docker desktop keep ports from changing on reboot windows
In this case I've installed an Ubuntu distro from the Windows store, but you might see different distros listed or even none. I also see that there's a new setting available for WSL Integration. Navigating to Settings -> Resources in docker desktop now that WSL integration is enabled I see can see that there's no longer an Advanced tab for configuring docker resources, which makes sense given what we've just talked about. wslconfig Accessing docker from another WSL distribution # entries must be size followed by unit, for example 8GB or 512MB. # entries must be absolute Windows paths with escaped backslashes, for example C:\\Users\\adamc\\kernel LocalhostForwarding= # Boolean specifying if ports bound to wildcard or localhost in the WSL2 VM should be connectable from the host via localhost:port (default true). SwapFile= # An absolute Windows path to the swap vhd. Swap= # How much swap space to add to the WSL2 VM. Processors= # How many processors to assign to the WSL2 VM. Memory= # How much memory to assign to the WSL2 VM. Kernel= # An absolute Windows path to a custom Linux kernel. Personally, though I've found that just leaving WSL alone to manage these for me has worked pretty smoothly. wslconfig file inside your user profile directory and setting any/all of the parameters below. If you want to modify config settings for WSL 2 to explicitly limit the available resources you can do that by creating a. This is the shared across all distros running under WSL 2 and the allocation of resources will be handled dynamically for you by WSL. Because docker is now running in a WSL distro it gets access to all the CPU cores and by default 80% of the RAM. Now I can see that docker has access to 8 CPU cores and 13GB of the 16GB installed in my laptop.

Those are used by the docker-desktop distro, the same result is achieved when docker is run under Hyper-V by mounting a VHD (Virtual Hard Disk) in the Hyper-V image but mounting a VHD isn't possible with WSL2 yet.īut moving on to more exciting news let's run docker info. that's seems strange, why does docker use two WSL distros when it only needs one Hyper-V VM? 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. Now instead I have two WSL distros running which I can see by running wsl -l -v. Once I Apply & Restart docker will restart and my DockerDesktopVM will no longer be running. To enable the WSL engine, I just need to go to Settings -> General and turn on Enable the experimental WSL 2 based engine. So that's a quick overview of how things work running docker in Hyper-V, now let's see how things are different with WSL. If I open up docker desktop Settings->Resources tab, I'll see the same settings and from here I can manually configure those available resources. Get-VMProcessorĪnd if I run docker info I can see that those are the resources available to my docker server. In my case docker has assigned 2GB of memory to the VM and if I run Get-VMProcessor I can see that my docker VM has two processors assigned. If you run Get-VM from PowerShell you can see that VM has the rather un-mysterious name DockerDesktopVM.
#Docker desktop keep ports from changing on reboot install
Docker desktop version 2.2.0.5 or later.īy default, docker desktop currently uses Hyper-V which means if you install it today and start it up, behind the scenes it will spin up a VM.Thanks to the Windows Subsystem for Linux 2 though it's now possible to run docker in a WSL distribution and avoid the need for Hyper-V altogether. Assign too many and you'll lose access to those resources from your Windows OS, assign too few and you'll see performance issues in your containers.

The CPU and memory resources allocated to the Hyper-V VM and therefore to your docker containers must be managed by you.Hyper-V requires Windows Professional, a ludicrous limitation, which made docker (and lots of other great tools) unavailable to Windows Home users.There are at least two, and probably more, problems with this approach: Running Docker on Windows has been easy for a long time, but it has always needed to run inside a Hyper-V virtual machine.
