32

I'm using Docker Toolbox, recently I got to know about the Docker installation using WSL 2.

What are the differences between Hyper-V and WSL 2? Which has better performance?

6
  • 3
    WSL 2 is using Hyper-V…?
    – Daniel B
    Jun 17 '20 at 8:48
  • I don't think so, I read somewhere it uses some mini virtual machine kind of stuff
    – Vinod Sai
    Jun 17 '20 at 8:53
  • Both are different
    – Vinod Sai
    Jun 17 '20 at 8:53
  • 1
    Hyper-v works only in windows Pro version. Wsl2 works in windows home version also
    – Vinod Sai
    Jun 17 '20 at 8:54
  • 2
    Yes, the full Hyper-V is only available in Pro. That does not change that WSL 2 is using Hyper-V. // Remember that comments are not a chat room.
    – Daniel B
    Jun 17 '20 at 9:02
11

Please read this: https://www.docker.com/blog/docker-hearts-wsl-2/

We will replace the Hyper-V VM we currently use by a WSL 2 integration package. This package will provide the same features as the current Docker Desktop VM: Kubernetes 1-click setup, automatic updates, transparent HTTP proxy configuration, access to the daemon from Windows, transparent bind mounts of Windows files, and more.

A technical preview of Docker Desktop for WSL 2 will be available for download in July. It will run side by side with the current version of Docker Desktop, so you can continue to work safely on your existing projects. If you are running the latest Windows Insider build, you will be able to experience this first hand. In the coming months, we will add more features until the WSL 2 architecture is used in Docker Desktop for everyone running a compatible version of Windows.

Additionally I recommend to watch this video: https://www.youtube.com/watch?v=lwhMThePdIo

Good comparison you will find here: https://blog.logrocket.com/working-with-node-js-on-hyper-v-and-wsl2/

cite:

Comparing Hyper-V to WSL2

The biggest difference between running Ubuntu Linux in a Hyper-V virtual machine versus running the operating system in WSL2 lies in the ability to access the Ubuntu user interface in Hyper-V.

The user interface allows you to install and use more than just command-line tools.

Depending on your system’s hardware performance, you likely found that WSL2 is the faster option. To expedite the process of running Ubuntu Linux on Hyper-V, you could set up SSH access to the virtual machine.

This speeds up command-line access. However, WSL2 may still have the upper hand since it does not require SSH to enable access.

1
4

Hyper-V and WSL2 (WSL2 runs on Virtual Machine Platform, the name of Hyper-V's architecture packaged separately and made available to all SKUs) could have negative interactions with other VM solutions, for example VirtualBox v5 and under will not coexist with Hyper-V. As of VirtualBox v6+ there is support to run VirtualBox in a configuration to replace its own virtualization with that of Hyper-V paravirtualization. In the recent past there are reports that 'performance will be worse' as outlined in Use VirtualBox and Hyper-V simultaneously. If this is of particular interest to you, I'd encourage you to research what progress has been made on that front.

When people judge WSL2 as being "faster" they're typically talking about setup time being easier and thus faster. Actual performance depends on how many presets and customizations were made for WSL2's Hyper-V instance but more importantly, it depends on your use cases.

  • Will you ONLY use WSL2 for Docker?
  • If no, how do you plan to use WSL2 outside of Docker?
  • Do you currently or plan to use any other Virtual Machines?
  • Do you require a lot of direct Win 10 <-> WSL2 file access (WSL2 has poor file system performance when lots of file activity takes place between the two)?

In the most basic of answers:

If you're ONLY using docker:
WSL2

If you require Linux, additional VMs or want access to Docker's Advanced tab for resource allocation:
Hyper-V

Final Note:
Although Hyper-V is officially unsupported for Windows 10 Home edition and is stated so throughout published material, there is a proposed way to enable it which can be found in this MicrosoftDocs Virtualization-Documentation issue posting. While I am unable to comment on how well it works or if it works at all, there are guides available if you wish to try.

0
1

Windows subsystem for linux 2 is a virtual machine for operating Linux. It initiallizes minimal hyper-v toolkit for booting Linux kernel. And hyper-v is virtualization software that can be used to virtualize other operating systems as well as Linux distros. The file sharing, command line, and networking between your Windows machine and the WSL2 environment is instant on launch. You do not have to manage this environment because it will update alongside Windows. If you don't want to virtualize other operating systems rather than linux, then uninstall hyper-v and choose wsl2 because hyper-v doesn't let other applications use virtualized hardware environment.

3
  • 1
    Since WSL 2 requires the Hyper-V hypervisor, it will still block other virtualization applications.
    – Daniel B
    Jun 17 '20 at 9:40
  • 3
    I found that the opposite is true - if you have WSL 2 installed, you can't use hosted VM platforms like virtualbox, but if you have the full Hyper-V installed (which can be alongside WSL 2), you can still use them because virtualbox can use Hyper-V as a wrapper around the processor's virtualisation interface.
    – Injektilo
    Aug 6 '20 at 15:11
  • @Injektilo if you have WSL 2 installed, you can't use hosted VM platforms like virtualbox .. that's not true for me .. when Hyper-V installed Vbox stopped working! And with WSL2 I think you can't Dockerize Windows Applications .. which this answer mentions Apr 17 at 2:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.