%3CLINGO-SUB%20id%3D%22lingo-sub-1483168%22%20slang%3D%22en-US%22%3ERe%3A%20Using%20WSL2%20in%20a%20Docker%20Linux%20container%20on%20Windows%20to%20run%20a%20Minecraft%20Java%20Edition%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1483168%22%20slang%3D%22en-US%22%3E%3CP%3EThanks%20for%20the%20Awesome%20blogpost%26nbsp%3B%3CIMG%20class%3D%22lia-deferred-image%20lia-image-emoji%22%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Fhtml%2Fimages%2Femoticons%2Fcool_40x40.gif%22%20alt%3D%22%3Acool%3A%22%20title%3D%22%3Acool%3A%22%20%2F%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1494148%22%20slang%3D%22en-US%22%3ERe%3A%20Using%20WSL2%20in%20a%20Docker%20Linux%20container%20on%20Windows%20to%20run%20a%20Minecraft%20Java%20Edition%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1494148%22%20slang%3D%22en-US%22%3E%3CP%3EThank%20you%20James%20for%20your%20great%20feedback!!!!%20%3Abeaming_face_with_smiling_eyes%3A%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1482133%22%20slang%3D%22en-US%22%3EUsing%20WSL2%20in%20a%20Docker%20Linux%20container%20on%20Windows%20to%20run%20a%20Minecraft%20Java%20Edition%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1482133%22%20slang%3D%22en-US%22%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22logo.png%22%20style%3D%22width%3A%20886px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F200170iFEA3AB92B2E7AA0A%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22logo.png%22%20alt%3D%22logo.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIn%20this%20post%20I%20will%20demonstrate%20how%20to%20update%20the%20%3CSTRONG%3EWindows%20Subsystem%20for%20Linux%20-%20WSL%26nbsp%3B%3C%2FSTRONG%3Eto%20version%202%20aka%20%3CSTRONG%3EWSL2%3C%2FSTRONG%3E.%20Once%20updated%2C%20I%20will%20demonstrate%20how%20to%20%3CSTRONG%3Econfigure%20Docker%20to%20use%20WSL2%3C%2FSTRONG%3E%20to%20run%20a%20%3CSTRONG%3ELinux%20Minecraft%20Java%20Edition%20container%3C%2FSTRONG%3E%20natively%20on%20Windows%20without%20emulation%2C%20i.e.%2C%20without%20a%20Hyper-V%20VM.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EPre-requirement%3A%3C%2FP%3E%0A%3CP%3ERunning%20Windows%2010%2C%20updated%20to%20version%202004%2C%20Build%2019041%20or%20higher.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId--1323127114%22%20id%3D%22toc-hId--1323127114%22%3EEnabling%20WSL%3C%2FH2%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIn%20case%20you%20don%E2%80%99t%20have%20the%20WSL%20installed%2C%20before%20installing%20any%20Linux%20distributions%20on%20Windows%2C%20you%20must%20enable%20the%20%3CSTRONG%3EWindows%20Subsystem%20for%20Linux%3C%2FSTRONG%3E%26nbsp%3Boptional%20feature.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22enable%20wsl%20feature.png%22%20style%3D%22width%3A%20415px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F200173iBF97AC764CB3F519%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22enable%20wsl%20feature.png%22%20alt%3D%22enable%20wsl%20feature.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIf%20you%20are%20using%20Windows%2010%202004%20or%20later%2C%20you%20can%20enable%20WSL%20through%20the%20following%20command%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-powershell%22%3E%3CCODE%3Ewsl.exe%20--install%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22wsl%20install.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F205253iE49CD4766B7757B5%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22wsl%20install.png%22%20alt%3D%22wsl%20install.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EYou%20need%20to%20restart%20restart%20Windows%20to%20apply%20the%20settings.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ENotice%20that%20wsl.exe%20--install%20command%20simplifies%20a%20lot%20the%20WSL%20and%20its%20dependencies.%20So%2C%20if%20you%20opted%20to%26nbsp%3B%3CSPAN%20style%3D%22font-family%3A%20inherit%3B%22%3Einstall%20using%20that%20command%2C%20please%20skip%20the%20%3C%2FSPAN%3E%3CSTRONG%20style%3D%22font-family%3A%20inherit%3B%22%3E%22Check%20the%20WSL%20Version%22%3C%2FSTRONG%3E%3CSPAN%20style%3D%22font-family%3A%20inherit%3B%22%3E%20and%20the%20%3CSTRONG%3E%22Enable%20the%20'Virtual%20Machine%20Platform'%20optional%20component%22%3C%2FSTRONG%3E%20sessions.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId-1164385719%22%20id%3D%22toc-hId-1164385719%22%3ECheck%20the%20WSL%20version%3C%2FH2%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThat%20session%20is%20only%20for%20those%20that%20already%20have%20WSL%201%20installed.%20If%20you%20are%20installing%20WSL%20from%20scratch%2C%20please%20skip%20this%20session.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIf%20you%20are%20using%20the%20Windows%20Build%2019041%20or%20higher%2C%20you%20can%20check%20the%20WSL%20version%20by%20opening%20the%20PowerShell%20command%20line%20and%20entering%20the%20following%20command%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-bash%22%3E%3CCODE%3Ewsl%20--list%20--verbose%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ESo%20far%2C%20I%20am%20running%20the%20version%20one%3A%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22wsl%20l%20v.png%22%20style%3D%22width%3A%20655px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F200179i87CB8968F22B15D9%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22wsl%20l%20v.png%22%20alt%3D%22wsl%20l%20v.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIn%20case%20you%20don't%20have%20a%20distro%20Linux%20installed%2C%20the%20following%20message%20will%20be%20displayed%20with%20the%20address%20to%20download%20a%20Linux%20distro%20on%20Microsoft%20Store%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22wsl%20witho%20distro.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F214730i9F44202967A62A1F%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22wsl%20witho%20distro.png%22%20alt%3D%22wsl%20witho%20distro.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId--643068744%22%20id%3D%22toc-hId--643068744%22%3EEnable%20the%20'Virtual%20Machine%20Platform'%20optional%20component%3C%2FH2%3E%0A%3CP%3EThat%20session%20doesn't%20apply%20if%20you%20installed%20WSL%20using%20the%20%3CSTRONG%3Ewsl.exe%20--install%3C%2FSTRONG%3E%20command.%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EBefore%20installing%20WSL%202%2C%20you%20must%20enable%20the%20%3CSTRONG%3EVirtual%20Machine%20Platform%3C%2FSTRONG%3E%26nbsp%3Boptional%20feature.%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId-1844444089%22%20id%3D%22toc-hId-1844444089%22%3E%26nbsp%3B%3C%2FH2%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22enable%20vmp%202.png%22%20style%3D%22width%3A%20415px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F200193i6C5D76395814A90A%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22enable%20vmp%202.png%22%20alt%3D%22enable%20vmp%202.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIf%20you%20prefer%2C%20it%20is%20possible%20to%20enable%20the%20feature%20using%20the%20following%20command%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-powershell%22%3E%3CCODE%3EEnable-WindowsOptionalFeature%20-Online%20-FeatureName%20VirtualMachinePlatform%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId-36989626%22%20id%3D%22toc-hId-36989626%22%3EVirtual%20Machine%3C%2FH2%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIn%20case%20you%20want%20to%20install%20WSL%202%20in%20a%20virtual%20machine%2C%20you%20need%20to%20turn%20off%20the%20VM%20and%20run%20the%20following%20command%20as%20admin%20%3CSTRONG%3Eon%20the%20host%20machine%3C%2FSTRONG%3E%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-powershell%22%3E%3CCODE%3ESet-VMProcessor%20-VMName%20Windows10%20-ExposeVirtualizationExtensions%20%24true%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ENotice%20that%20Windows10%20is%20the%20name%20of%20my%20virtual%20machine%20on%20Hyper-V%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22hyper-v.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F206495i1243CC84694FA0D8%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22hyper-v.png%22%20alt%3D%22hyper-v.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId--1770464837%22%20id%3D%22toc-hId--1770464837%22%3EInstall%20your%20Linux%20distribution%20of%20choice%3C%2FH2%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIn%20case%20you%20don%E2%80%99t%20have%20a%20Linux%20distribution%20installed%2C%20you%20need%20to%20download%20install%20it%20from%20Microsoft%20Store.%20Follows%20some%20options%20available%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Faka.ms%2Fwslstore%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Faka.ms%2Fwslstore%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22linux%20distr%20on%20store.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F200175i5C966B2D10455FF5%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22linux%20distr%20on%20store.png%22%20alt%3D%22linux%20distr%20on%20store.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EI%20am%20using%20Ubuntu%2020.04%20LTS%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22Ubuntu.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F200178iFB87772460DEB82A%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22Ubuntu.png%22%20alt%3D%22Ubuntu.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EBefore%20launching%20the%20Linux%20distro%2C%20we%20need%20to%20update%20WSL%20to%20version%202.%26nbsp%3BIn%20the%20next%20session%20it%20will%20be%20demonstrated%20how%20to%20install%20WSL2.%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId-717047996%22%20id%3D%22toc-hId-717047996%22%3EInstalling%20WSL2%3C%2FH2%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EWSL2%20is%20now%20available%20in%20the%20initial%20release%20of%20Windows%2010%2C%20version%202004%20and%20Windows%20Insiders%20slow%20ring.%20But%20for%20now%2C%20to%20enable%20WSL2%20you%20need%20to%20%3CSTRONG%3Emanually%20install%3C%2FSTRONG%3E%20the%20Linux%20kernel.%20It%20is%20a%20temporary%20solution%20and%2C%20in%20a%20few%20months%2C%20WSL2%20will%20be%20automatically%20updated%20just%20like%20regular%20updates%20on%20your%20machine.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EUse%20the%20following%20direct%20link%20to%20%3CSTRONG%3Edownload%20the%20installer%20for%20the%20Linux%20kernel%20update%3C%2FSTRONG%3E%20package%3A%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fwslstorestorage.blob.core.windows.net%2Fwslblob%2Fwsl_update_x64.msi%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fwslstorestorage.blob.core.windows.net%2Fwslblob%2Fwsl_update_x64.msi%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20link%20is%20available%20at%3A%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fwindows%2Fwsl%2Fwsl2-kernel%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fwindows%2Fwsl%2Fwsl2-kernel%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ERun%20the%20update%20setup%20to%20install%20WSL2%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22wsl2.png%22%20style%3D%22width%3A%20495px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F200184iC48A04334B587587%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22wsl2.png%22%20alt%3D%22wsl2.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20installation%20process%20is%20straightforward%20and%20you%20only%20need%20to%20follows%20the%20default%20options.%20The%20following%20UI%20will%20be%20displayed%20after%20successfully%20updated%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22wsl%20installed.png%22%20style%3D%22width%3A%20495px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F200187iF0C7DC0EC75F89E7%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22wsl%20installed.png%22%20alt%3D%22wsl%20installed.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId--1090406467%22%20id%3D%22toc-hId--1090406467%22%3EFinish%20the%20Ubuntu%20installation%3C%2FH2%3E%0A%3CP%3EThis%20session%20applies%20only%20for%20those%20that%20are%20installing%20Ubuntu%20or%20other%20Linux%20distro%20for%20the%20first%20time.%20Now%20that%20WSL%202%20Kernel%20update%20is%20installed%2C%20you%20can%20open%20the%20Ubuntu%20App%20to%20complete%20the%20settings%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22ubuntu%20first%20launch.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F206504iAC815E9EEDFADC79%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22ubuntu%20first%20launch.png%22%20alt%3D%22ubuntu%20first%20launch.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId-1397106366%22%20id%3D%22toc-hId-1397106366%22%3ESet%20your%20distribution%20version%20to%20WSL%202%3C%2FH2%3E%0A%3CP%3EPlease%20skip%20this%20session%20in%20case%20you%20are%20installing%20WSL%20for%20the%20first%20time.%26nbsp%3BThis%20step%20is%20only%20necessary%20for%20those%20that%20already%20were%20using%20Ubuntu.%20You%20can%20now%20open%20Ubuntu%20to%20finish%20the%20setup.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ENow%20that%20you%20have%20installed%20WSL2%2C%20it%20is%20necessary%20to%20run%20the%20following%20PowerShell%20command%20to%20update%20WSL%20to%20version%202%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-bash%22%3E%3CCODE%3Ewsl%20--set-version%20Ubuntu-20.04%202%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3ENOTE%3A%20Ubuntu-20.04%3C%2FSTRONG%3E%20is%20the%20name%20of%20the%20Linux%20distribution%20that%20I%20am%20using.%20You%20can%20run%20%3CSTRONG%3Ewsl%20-l%20-v%3C%2FSTRONG%3E%20to%20list%20the%20Linux%20distributions%20installed.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22wsl%20sv%202.png%22%20style%3D%22width%3A%20835px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F200195i9D2E96297E3373DE%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22wsl%20sv%202.png%22%20alt%3D%22wsl%20sv%202.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EOtherwise%2C%20all%20you%20have%20to%20do%20is%20to%20launch%20Ubuntu%20to%20finish%20the%20settings%2C%20like%20define%20user%20and%20password.%20WSL%202%20will%20be%20automatically%20set.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId--410348097%22%20id%3D%22toc-hId--410348097%22%3ESet%20WSL%202%20as%20your%20default%20version%3C%2FH2%3E%0A%3CP%3EPlease%20skip%20this%20session%20in%20case%20you%20are%20installing%20WSL%20for%20the%20first%20time.%26nbsp%3BThis%20step%20is%20only%20necessary%20for%20those%20that%20already%20were%20using%20Ubuntu.%20You%20can%20now%20open%20Ubuntu%20to%20finish%20the%20setup.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EYou%20need%20to%20run%20the%20following%20command%20in%20PowerShell%20to%20set%20WSL%202%20as%20the%20default%20version%20in%20case%20you%20want%20to%20install%20others%20Linux%20distribution%20in%20the%20future%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-bash%22%3E%3CCODE%3Ewsl%20--set-default-version%202%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22wsl2%20default%20version.png%22%20style%3D%22width%3A%20853px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F200200iEB230E4A96BF7432%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22wsl2%20default%20version.png%22%20alt%3D%22wsl2%20default%20version.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIf%20you%20run%20again%20the%20following%20command%20you%20will%20see%20that%20WSL2%20was%20successfully%20installed%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-bash%22%3E%3CCODE%3Ewsl%20-l%20-v%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22wsl%20l%20v%202.png%22%20style%3D%22width%3A%20736px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F200204iC20BD695FB148D42%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22wsl%20l%20v%202.png%22%20alt%3D%22wsl%20l%20v%202.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIn%20the%20next%20session%20I%20will%20configure%20Docker%20to%20use%20WSL2%20for%20Linux%20containers%20on%20Windows%2010.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId--544032821%22%20id%3D%22toc-hId--544032821%22%3EEnable%20WSL2%20on%20Docker%3C%2FH2%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ENow%20that%20we%20have%20installed%20%3CSTRONG%3EWSL2%2C%3C%2FSTRONG%3E%20we%20can%20configure%20it%20on%20%3CSTRONG%3EDocker%20Desktop%20for%20Windows%3C%2FSTRONG%3E.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EWindows%20Subsystem%20for%20Linux%20(WSL)%202%20introduces%20a%20significant%20architectural%20change%20as%20it%20is%20a%20full%20Linux%20kernel%20built%20by%20Microsoft%2C%20%3CSTRONG%3Eallowing%20Linux%20containers%20to%20run%20natively%20without%20emulation%3C%2FSTRONG%3E.%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EDocker%20Desktop%20uses%20the%20dynamic%20memory%20allocation%20feature%20in%20%3CSTRONG%3EWSL%202%20to%20greatly%20improve%20the%20resource%20consumption%3C%2FSTRONG%3E.%20This%20means%2C%20Docker%20Desktop%20only%20uses%20the%20required%20amount%20of%20CPU%20and%20memory%20resources%20it%20needs%2C%20while%20enabling%20CPU%20and%20memory-intensive%20tasks%20such%20as%20building%20a%20container%20to%20run%20much%20faster.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAdditionally%2C%20with%20WSL%202%2C%20%3CSTRONG%3Ethe%20time%20required%20to%20start%20a%20Docker%20daemon%20after%20a%20cold%20start%20is%20significantly%20faster%3C%2FSTRONG%3E.%20It%20takes%20%3CSTRONG%3Eless%20than%2010%20seconds%20to%20start%20the%20Docker%20daemon%3C%2FSTRONG%3E%20when%20compared%20to%20almost%20a%20minute%20in%20the%20previous%20version%20of%20Docker%20Desktop.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EMore%20details%20at%3A%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EDocker%20Desktop%20WSL%202%20backend%3C%2FP%3E%0A%3CP%3E%3CSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.docker.com%2Fdocker-for-windows%2Fwsl%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.docker.com%2Fdocker-for-windows%2Fwsl%2F%3C%2FA%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIf%20you%20are%20running%20a%20supported%20system%2C%20Docker%20will%20prompt%20you%20to%20enable%20WS2%20during%20initialization.%3C%2FP%3E%0A%3CP%3EIt%20is%20possible%20to%20enable%20WSL2%20in%20the%20%3CSTRONG%3ESettings%3C%2FSTRONG%3E%20%3CSTRONG%3E%26gt%3B%3C%2FSTRONG%3E%20%3CSTRONG%3EGeneral%3C%2FSTRONG%3E%20options%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22docker%20wsl2%20launch.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F200219iF726AA0C10C905A7%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22docker%20wsl2%20launch.png%22%20alt%3D%22docker%20wsl2%20launch.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ENow%20that%20we%20have%20Docker%20configured%20to%20run%20Linux%20containers%20using%20the%20WSL2%20engine%2C%20we%20can%20test%20it%20with%20a%20Minecraft%20Linux%20container.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId-1943480012%22%20id%3D%22toc-hId-1943480012%22%3EMinecraft%20Linux%20Container%3C%2FH2%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ETo%20demonstrate%20the%20use%20of%20Docker%20with%20WSL2%2C%20I%26nbsp%3Bwill%20use%20the%26nbsp%3B%3CA%20title%3D%22itzg%2Fdocker-minecraft-server%22%20href%3D%22https%3A%2F%2Fgithub.com%2Fitzg%2Fdocker-minecraft-server%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Eitzg%2Fdocker-minecraft-server%3C%2FA%3E%26nbsp%3BDocker%20Linux%20image%20t%3CSPAN%3Ehat%20provides%20a%20Minecraft%20Java%20Edition%20Server.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EYou%20can%20use%20the%20following%20command%20to%20download%20and%20run%20the%20latest%20Minecraft%20Server%20image%3A%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3E%3C!--StartFragment%20--%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CDIV%3E%3CPRE%20class%3D%22lia-code-sample%20language-bash%22%3E%3CCODE%3Edocker%20run%20-e%20EULA%3DTRUE%20-d%20-p%2025565%3A25565%20--name%20mc%20itzg%2Fminecraft-server%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FDIV%3E%0A%3CP%3E%3CSPAN%3E%3C!--EndFragment%20--%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22docker%20pull.gif%22%20style%3D%22width%3A%20790px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F200277iF67AB6822D0410CD%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22docker%20pull.gif%22%20alt%3D%22docker%20pull.gif%22%20%2F%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EObserve%20that%20with%20WSL2%2C%20the%20container%20initialization%20was%20only%2010%20seconds%3A%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22docker%20start.gif%22%20style%3D%22width%3A%20948px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F200284i4245D836464557F6%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22docker%20start.gif%22%20alt%3D%22docker%20start.gif%22%20%2F%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EI%20hope%20you%20liked!%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EFollows%20some%20references%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EWindows%20Subsystem%20for%20Linux%20Installation%20Guide%20for%20Windows%2010%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fwindows%2Fwsl%2Finstall-win10%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fwindows%2Fwsl%2Finstall-win10%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EUpdating%20the%20WSL%202%20Linux%20kernel%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fwindows%2Fwsl%2Fwsl2-kernel%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fwindows%2Fwsl%2Fwsl2-kernel%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EGet%20started%20with%20Docker%20for%20Windows%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.docker.com%2Fdocker-for-windows%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.docker.com%2Fdocker-for-windows%2F%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EDocker%20Desktop%20WSL%202%20backend%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.docker.com%2Fdocker-for-windows%2Fwsl%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.docker.com%2Fdocker-for-windows%2Fwsl%2F%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-1482133%22%20slang%3D%22en-US%22%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22logo.png%22%20style%3D%22width%3A%20886px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F200170iFEA3AB92B2E7AA0A%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22logo.png%22%20alt%3D%22logo.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIn%20this%20post%20I%20will%20demonstrate%20how%20to%20update%20the%20WSL%20(Windows%20Subsystem%20for%20Linux)%20to%20version%202%20aka%20WSL2.%20Once%20updated%2C%20I%20will%20demonstrate%20how%20to%20configure%20Docker%20to%20use%20WSL2%20to%20run%20a%20Linux%20Minecraft%20Java%20Edition%20container%20natively%20on%20Windows%20without%20emulation.%3C%2FP%3E%3C%2FLINGO-TEASER%3E
Microsoft

 

logo.png

 

 

In this post I will demonstrate how to update the Windows Subsystem for Linux - WSL to version 2 aka WSL2. Once updated, I will demonstrate how to configure Docker to use WSL2 to run a Linux Minecraft Java Edition container natively on Windows without emulation, i.e., without a Hyper-V VM.

 

Pre-requirement:

Running Windows 10, updated to version 2004, Build 19041 or higher.

 

Enabling WSL

 

In case you don’t have the WSL installed, before installing any Linux distributions on Windows, you must enable the Windows Subsystem for Linux optional feature.

 

 

enable wsl feature.png

 

 

If you are using Windows 10 2004 or later, you can enable WSL through the following command:

 

 

wsl.exe --install

 

 

wsl install.png

 

You need to restart restart Windows to apply the settings.

 

Notice that wsl.exe --install command simplifies a lot the WSL and its dependencies. So, if you opted to install using that command, please skip the "Check the WSL Version" and the "Enable the 'Virtual Machine Platform' optional component" sessions.

 

Check the WSL version

 

That session is only for those that already have WSL 1 installed. If you are installing WSL from scratch, please skip this session.

 

If you are using the Windows Build 19041 or higher, you can check the WSL version by opening the PowerShell command line and entering the following command:

 

 

 

wsl --list --verbose

 

 

So far, I am running the version one: 

 

wsl l v.png

 

In case you don't have a distro Linux installed, the following message will be displayed with the address to download a Linux distro on Microsoft Store:

 

wsl witho distro.png

 

 

Enable the 'Virtual Machine Platform' optional component

That session doesn't apply if you installed WSL using the wsl.exe --install command. 

 

Before installing WSL 2, you must enable the Virtual Machine Platform optional feature.

 

enable vmp 2.png

 

 

If you prefer, it is possible to enable the feature using the following command:

 

 

Enable-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform

 

Virtual Machine

 

In case you want to install WSL 2 in a virtual machine, you need to turn off the VM and run the following command as admin on the host machine:

 

 

Set-VMProcessor -VMName Windows10 -ExposeVirtualizationExtensions $true

 

 

Notice that Windows10 is the name of my virtual machine on Hyper-V:

 

hyper-v.png

 

 

Install your Linux distribution of choice

 

In case you don’t have a Linux distribution installed, you need to download install it from Microsoft Store. Follows some options available:

 

https://aka.ms/wslstore

 

linux distr on store.png

 

 

I am using Ubuntu 20.04 LTS:

 

Ubuntu.png

 

 

Before launching the Linux distro, we need to update WSL to version 2. In the next session it will be demonstrated how to install WSL2. 

 

Installing WSL2

 

WSL2 is now available in the initial release of Windows 10, version 2004 and Windows Insiders slow ring. But for now, to enable WSL2 you need to manually install the Linux kernel. It is a temporary solution and, in a few months, WSL2 will be automatically updated just like regular updates on your machine.

 

Use the following direct link to download the installer for the Linux kernel update package:

https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msi

 

The link is available at: https://docs.microsoft.com/en-us/windows/wsl/wsl2-kernel

 

Run the update setup to install WSL2:

 

 

wsl2.png

 

 

The installation process is straightforward and you only need to follows the default options. The following UI will be displayed after successfully updated:

 

wsl installed.png

 

 

Finish the Ubuntu installation

This session applies only for those that are installing Ubuntu or other Linux distro for the first time. Now that WSL 2 Kernel update is installed, you can open the Ubuntu App to complete the settings:

 

ubuntu first launch.png

 

 

Set your distribution version to WSL 2

Please skip this session in case you are installing WSL for the first time. This step is only necessary for those that already were using Ubuntu. You can now open Ubuntu to finish the setup.

 

Now that you have installed WSL2, it is necessary to run the following PowerShell command to update WSL to version 2:

 

 

 

wsl --set-version Ubuntu-20.04 2

 

 

 

NOTE: Ubuntu-20.04 is the name of the Linux distribution that I am using. You can run wsl -l -v to list the Linux distributions installed.

 

 

wsl sv 2.png

 

Otherwise, all you have to do is to launch Ubuntu to finish the settings, like define user and password. WSL 2 will be automatically set.

 

Set WSL 2 as your default version

Please skip this session in case you are installing WSL for the first time. This step is only necessary for those that already were using Ubuntu. You can now open Ubuntu to finish the setup.

 

You need to run the following command in PowerShell to set WSL 2 as the default version in case you want to install others Linux distribution in the future:

 

 

 

wsl --set-default-version 2

 

 

 

 

wsl2 default version.png

 

 

If you run again the following command you will see that WSL2 was successfully installed:

 

 

 

 

wsl -l -v

 

 

 

 

wsl l v 2.png

 

 

In the next session I will configure Docker to use WSL2 for Linux containers on Windows 10.

 

Enable WSL2 on Docker

 

Now that we have installed WSL2, we can configure it on Docker Desktop for Windows.

 

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

 

Docker Desktop uses the dynamic memory allocation feature in WSL 2 to greatly improve the resource consumption. This means, Docker Desktop only uses the required amount of CPU and memory resources it needs, while enabling CPU and memory-intensive tasks such as building a container to run much faster.

 

Additionally, with WSL 2, the time required to start a Docker daemon after a cold start is significantly faster. It takes less than 10 seconds to start the Docker daemon when compared to almost a minute in the previous version of Docker Desktop.

 

More details at:

 

Docker Desktop WSL 2 backend

https://docs.docker.com/docker-for-windows/wsl/

 

If you are running a supported system, Docker will prompt you to enable WS2 during initialization.

It is possible to enable WSL2 in the Settings > General options:

 

docker wsl2 launch.png

 

Now that we have Docker configured to run Linux containers using the WSL2 engine, we can test it with a Minecraft Linux container.

 

Minecraft Linux Container

 

To demonstrate the use of Docker with WSL2, I will use the itzg/docker-minecraft-server Docker Linux image that provides a Minecraft Java Edition Server.

 

You can use the following command to download and run the latest Minecraft Server image:

 

docker run -e EULA=TRUE -d -p 25565:25565 --name mc itzg/minecraft-server

 

 

docker pull.gif

 

 

Observe that with WSL2, the container initialization was only 10 seconds:

 

docker start.gif

 

 

I hope you liked!

 

Follows some references:

 

Windows Subsystem for Linux Installation Guide for Windows 10

https://docs.microsoft.com/en-us/windows/wsl/install-win10

 

Updating the WSL 2 Linux kernel

https://docs.microsoft.com/en-us/windows/wsl/wsl2-kernel

 

Get started with Docker for Windows

https://docs.docker.com/docker-for-windows/

 

Docker Desktop WSL 2 backend

https://docs.docker.com/docker-for-windows/wsl/

 

 

 

2 Comments

Thanks for the Awesome blogpost :cool:

Microsoft

Thank you James for your great feedback!!!! :beaming_face_with_smiling_eyes: