19

I understand that it is currently possible to run Ubuntu on Windows 10 in two different ways:

  1. Using the Windows Subsystem for Linux (WSL).
  2. Installing docker for Windows 10, and use a container with Ubuntu.

However, I could not find an easy to understand explanation of what are the differences between them (talking about applications), as well as advantages and disadvantages.

I found a post talking about using docker on WSL: Ubuntu via (Windows Linux Subsystem) and Docker. But I'm talking about using it directly on Windows 10. So I will appreciate any information about these two.

1
  • I'm no expert in any of them to write an answer, but my vote goes to Docker. The reason is that Docker implies virtualization, so things should just work. WSL on the other hand is full of bugs. It does work for benchmarks, fun, and mostly development; but if you're about to deploy something serious, this is not your choice, at least not yet.
    – Hi-Angel
    Nov 1 '17 at 22:16
19

Updated 2020/02/18 to reflect changes introduced in WSL2

Hi! Microsoft PM working on WSL & Command Line here.

WSL allows you to run native, unmodified Linux ELF-64 binaries directly on Windows, and enables you to run your favorite Linux tools atop your Windows "host" OS.

WSL1 took an approach of adding a Linux syscall compatible layer at the top of the NT kernel, allowing Linux binaries to run atop NT, sharing the same underlying filesystem, networking, process list, etc. as the host OS.

The soon to be released WSL2, on the other hand, runs distros' binaries within Linux containers, atop a real Linux kernel, inside a lightweight VM that allocates only the RAM needed by the apps it runs, and then releases freed RAM back to the host OS. This provides 100% Linux compatibility, and allows your Linux tools to run with near native performance, and consumes minimum resources necessary from the host, ensuring your machine runs fast and smoothly.

Prior to WSL2, one could run the Docker client in WSL1, using it to drive Docker for Windows running atop Hyper-V on the local host, or to manage a remote Docker server. But one cannot run Docker Engine on WSL1 for many technical reasons.

However, you can do the same in Docker on WSL2, but you can also run the Docker Engine itself atop WSL if you prefer. This is, Docker's preferred and future path for running Docker on Windows desktop.

To learn more about WSL, review the videos & docs here: https://aka.ms/learnwsl

2
  • I think this answer refers to WSL, WSL 2 runs a custom linux kernel, that interfaces with windows. I believe that custom windows linux kernel runs in a VM. Feb 13 '20 at 7:24
  • 1
    It did. Just posted an update to better reflect our WSL2 reality :) Feb 19 '20 at 0:18
3

That is correct. One thing that you do fail to mention is that WSL is currently rather slow in io even with a fast ssd/lots of ram/8-core xeon cpu. This is still a problem in 01/2019. I just did a ray@DESKTOP-O0MT13B:/mnt/c/Users/rayjh$ dd if=/dev/zero of=test bs=64k count=16k conv=fdatasync on my workstation with a samsung SSD and only got 97.6 MB/s.

Running bare metal ubuntu LTS this box will get SEVERAL times that. Never mind the endless problems when you try to combine WSL with VSCODE.

I'm wiping windows 10 off of here and installing ubuntu 18.04LTS.

4
  • 2
    You don't need to be toxic, especially at the end. Rather, please tell us what you did to research the cause of the problems you're facing and whether they are known issues or not and if someone is working on fixing them or not. I'm sure they are though. And you don't need to uninstall windows, you just need to install hyper-v manager and quick install Ubuntu and you're set for a Linux development environment if you want to work from inside a virtual Linux Desktop. Otherwise keep using WSL and wait for your issues to be fixed. 97 MB/s is not that slow. Feb 9 '19 at 21:34
  • 2
    AFAIK the speed issues are related to Windows file access subsystem and a workaround is in the works. Feb 9 '19 at 21:35
  • 1
    WSL still seems slow. But it does have a very fast start up time, and allow the use of common linux cli tools. Mapping the linux and windows file system seems complicating. Feb 13 '20 at 7:26
  • It has gotten perceptibly faster. However I tried using miniconda and installing packages and it was still a little slow.
    – rayj
    Feb 21 '20 at 4:56

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.