This isn’t anything ground breaking but something that is really awesome for those that run SQL Server on Linux using Docker Desktop for Windows, Windows 10 (SDK version 2004, Build 19041 or higher) now ships with Windows Subsystem for Linux (WSL) 2.
I won’t go too much into what this is as you can read the article in the links above but to summarise, this will improve the experience of docker on windows:
- Improvements in resource consumption
- Starting up docker daemon is significantly quicker (Docker says 10s as opposed to ~1min previously)
- Avoid having to maintain both Linux and Windows build scripts
- Improvements to file system sharing and boot time
- Allows access to some cool new features for Docker Desktop users.
Some of these are improvements we’ve been crying out for over the last couple of years so in my opinion, they’re a very welcome addition.
In order to get started using WSL2, there’s a couple of steps you need to run through which I’ll try and show below with a few screen shots.
Before we can do anything, please make sure that you have the downloads from the link in the previous section
Install Docker Desktop
Nothing to report on here, fairly straight forward click, click click
Once installed, depending on what the state of you machine is currently, you may see this message regarding installing WSL2:
Simply follow the information and enable the optional feature either using the powershell provided:
Enable-WindowsOptionalFeature -Online -FeatureName $("VirtualMachinePlatform", "Microsoft-Windows-Subsystem-Linux")
Or you can go to the windows features and enable it manually:
Once you have done this you will be prompted to install the Linux Kernel update package (See downloads). You can reboot before doing this (another reboot may be required after) but I managed to install it and just do a single reboot:
Takes about 2 seconds to update
Depending on your setup, there may be a couple of additional steps if you follow this link:
Open the Docker settings and you should now see the option to use the WSL 2 based engine:
If you wish to see what version of WSL you have then you can run the command below in an elevated command prompt:
wsl --list --verbose
I already have the Ubuntu distribution installed so I didn’t have to do this, you may need to install this:
If you click launch then the dstro will start:
Run SQL Server on Linux
docker run -e "ACCEPT_EULA=Y" ` -e "SA_PASSWORD=P@ssword1" ` --cpus="2" ` --name SQLLinuxLocal -d ` -p 1433:1433 ` <<Put Your Image Name here>>
docker ps -a
I can’t say too much about the various performance improvements so far but the daemon startup is certainly a lot quicker than previously. Perhaps some testing of the performance is in order and another blog post……. 😜