In this blog we will setup a Windows 11 machine in Azure and then install Docker Desktop on top of it. As of today we don't have Windows 11 image available in Azure's Marketplace. So first we will install the latest Windows 10 image and then by leveraging the Windows Insider program we can upgrade the box to Windows 11.
To install Docker Desktop on Windows 10 in Azure you need to make sure that the VM Size during the deployment should support Nested Virtualization. You can now enable nested virtualization using the Dv3 and Ev3 VM sizes.
So lets start with installing a Windows 10 box using the image Windows 10 Pro, Vershion 20H2 - Gen2
You may install the Windows 10 machine using azure cli
as below -
az vm create --resource-group rg-dockeraci \
--name dockerdesktop \
--size standard_d2s_v3 \
--location southeastasia \
--vnet-name ddVnet \
--subnet ddSubnet \
--admin-username dockeradmin \
--public-ip-address ddPublicIpAddress \
--public-ip-sku Standard \
--image MicrosoftWindowsDesktop:Windows-10:20h2-pro-g2:latest
To find the list of images you may use the below command -
az vm image list --publisher MicrosoftWindowsDesktop --offer Windows-10 --sku 20h2-pro-g2 --all
[
{
"offer": "Windows-10",
"publisher": "MicrosoftWindowsDesktop",
"sku": "20h2-pro-g2",
"urn": "MicrosoftWindowsDesktop:Windows-10:20h2-pro-g2:19042.1083.2107060609",
"version": "19042.1083.2107060609"
},
{
"offer": "Windows-10",
"publisher": "MicrosoftWindowsDesktop",
"sku": "20h2-pro-g2",
"urn": "MicrosoftWindowsDesktop:Windows-10:20h2-pro-g2:19042.1110.2107101724",
"version": "19042.1110.2107101724"
}
]
Once the VM is up and running in Azure navigate to Settings > Update & Security > Windows Insider Program
and follow the directions on the screen to choose the experience and channel you'd like to get Insider Preview builds through. If you haven’t registered yet for the Windows Insider the program then you may get started here.
Once activating the Windows Insider on your VM it should download the latest updates available which would include Windows 11 Insider Preview as shown below:
After downloading the update give it a restart to upgrade your VM to Windows 11. Download the Docker Dekstop for Windows and run the installation for it:
When Docker Desktop starts for the first time it should throw an error as shown below:
This is because WSL2 is missing the latest kernel updates which you may download from here
Once you have installed the latest kernel updates and restarted the VM you should the Docker Desktop running in Linux Containers
mode fine
Let’s switch to Windows Containers
mode
This time you should see another error as the Hyper-V
and Containers
features required are not enabled by default.
You may enable these features by executing the below command:
Enable-WindowsOptionalFeature -Online -FeatureName $(“Microsoft-Hyper-V”,”Containers”) -All
After the above commands executes, give a restart to the VM and this should now enable the Windows Container
mode
Let’s run our first container on the Windows 11 as below:
docker run -it mcr.microsoft.com/windosws/servercore:ltsc2019 cmd.exe