Friday, August 25, 2023

Docker: Error Message "Windows Containers are not supported on your version of windows"

On a Windows host where Docker is configured to use Windows (versus Linux) contains the following error message, "Windows Containers are not supported on your version of windows", can be encountered. There are multiple reasons for this error message but one of the most common is that it is only possible to run Windows containers on Windows Pro or Windows Enterprise edition. Docker cannot run Windows containers on Windows Home or Windows Education edition.

Docker's setup instructions for Windows can be found at Install Docker Desktop on Windows. A the top of this web page, under System Requirements is the following (as of August 23, 2023):


There is nothing in the above documentation stating that Windows Home and Education only support Linux containers. There is nothing in the above documentation stating that in order to supports both Linux and Windows containers Windows Pro or Windows Enterprise is required.

Note: I have submitted a Pull Request to Docker's documentation repo (Docker docs)  requesting the text be changed to include the sentences "Home and Education editions support only Linux containers. Pro and Enterprise editions support Windows containers and Linux containers." alongside the Windows 11 and Windows 10 system requirements.

Dockers Windows install documentation (Install Docker Desktop on Windows) does include a note well below the "System requirements" tab that presents which editions of Windows are required in order to run Windows containers:




Monday, August 14, 2023

Windows 10: Install Windows Terminal Without Windows Store

I was handed a laptop for a project that was Windows 10. Windows Terminal was not installed. On Windows 11 22H2, Windows Terminal is the default "command line experience" (see Windows Terminal is now the Default in Windows 11). Microsoft recommends installing Window Terminal using the Windows Store (see Windows Terminal). The laptop I was given was a corporate laptop and Windows Store was unavailable.

It is possible to download and install Windows Terminal from Windows Terminal Releases. Below are assets for Windows Terminal v1.17.11461.0:


The easiest way to install is to just download and invoke the MSIX bundle.


Sunday, August 13, 2023

PowerShell (failure): New-TemporaryFile Cannot Create a New Filename without Creating a File

In PowerShell the standard way to create a temporary filename is to invoke the System.IO namespace's Path class's GetTempFileName method. To be clear, only a filename is retrieved and no actual file is created. An example of GetTempFileName being invoked by PowerShell is as follows:

[string] $tempFilenameFromCsharp = ` 
               [System.IO.Path]::GetTempFileName() 

The results of the code above will vary because the filename is randomly generated and the method uses a user's environment variable, $env:TEMP. An example of the value assigned to $tempFilenameFromCsharp when the code snippet above being invoked is as follows:

C:\Users\jann\AppData\Local\Temp\tmpCF88.tmp

The New-TemporaryFile PowerShell cmdlet creatse a new temporary file and returns a corresponding instance of the System.IO.FileInfo class whihc include information such as the name of the file created.

My theory that I felt had a 20% chance of working: Invoke New-TemporaryFile with the -WhatIf command-line option and instead of creating a temporary file, the comdlet will return the name of the temporary file that would have been created.

For those that need a reminder, the WhatIf command-line option is defined as follows (see: WhatIf Switch):


My attempt to use New-TemporaryFile to create filename without creating a file was as follows:

[System.IO.FileInfo] $tempFilenameFromPowerShell = `
                         New-TemporaryFile -WhatIf -ErrorAction Stop

The output from invoking the above command is follows:


The following code tests if the $tempFilenameFromPowerShell variable is assigned to $null:


Since $tempFilenameFromPowerShell is set to $null so New-TemporaryFile combined with -WhatIf does not create a new filename. 

Not every idea we try works.