visit
With Docker Desktop running on WSL 2, users can leverage Linux workspaces and avoid having to maintain both Linux and Windows build scripts.
How is it different?
Windows Subsystem for Linux (WSL) 2 introduces a significant architectural change as it is a full Linux kernel built by Microsoft, allowing Linux containers to run natively without emulation.Starting with WSL2, Docker can run in it’s full flow in Windows and you can use images built for Linux.Below tutorial will help you install Docker on your WSL in windows.
Install Windows 10, version 2004 or higher (Build 19041 or higher).
At the moment of writing this article, to update to Windows 10 version 2004 (Build 19041), you will need to join the Windows Insider program and select the “Release Preview” ring. The public release should arrive by late May.Enable WSL 2 feature on Windows.
Open PowerShell as Administrator and run:dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
Enable the ‘Virtual Machine Platform’ optional component
Open PowerShell as Administrator and run:dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
Install the linux kernel package required to update the WSL version to WSL 2.
Details of kernel are in below link,Installer is at,Set WSL 2 as your default version
Open PowerShell as Administrator and run:wsl --set-default-version 2
Install your Linux distribution of choice
Open the Microsoft Store and select your favorite Linux distribution.Some of the popular one’s are below :wsl -l -v
Set the distribution to use WSL 2
wsl --set-version <distribution name> <versionNumber>
Add
%UserProfile%\.wslconfig
file for tweaking WSL2 settings[wsl2] kernel=<path> # An absolute Windows path to a custom Linux kernel. memory=<size> # How much memory to assign to the WSL2 VM. processors=<number> # How many processors to assign to t
he WSL2 VM. swap=<size> # How much swap space to add to the WSL2 VM. 0 for no swap file. swapFile=<path> # An absolute Windows path to the swap vhd.
localhostForwarding=<bool> # Boolean specifying if ports bound to wildcard or localhost in the WSL2 VM should be connectable from the host via localhost:port (default true).
Test Docker: Getting-Started
From the official documentation of Docker, lets test Getting-Started guide.git clone //github.com/docker/getting-started.git
Note that we are running this in WSL terminal of your linux distro.
docker run -d -p 80:80 --name docker-tutorial docker101tutorial
Previously published at