Troubleshooting Docker

As I work with my teams to begin integrating docker into our processes, we are finding, as with anything new, a few oddities depending on the machine or user. This is a collection of some of these error messages and how we found to solve them.

For additional help when dealing with #sitecore specific errors you should check out the official documentation troubleshooting guide at https://containers.doc.sitecore.com/docs/troubleshooting.

Error About ‘Image Operating System’

ERROR: image operating system "windows" cannot be used on this platform

RESOLUTION

This error will occur if Docker is not configured to support Windows containers. The default state of Docker after installation is always for Linux-based containers.

  1. Go to the Notification Tray and click the whale (Docker icon)

Docker Icon in Tray

  1. From the menu selection, if there is an option for Switch to Windows containers click it.

Options

Docker An Error Occurred

While attempting to switch Docker from Linux to Windows container support the following messages may display

An error occurred: Required Windows feature(s) not enabled: Hyper-V and Containers. Docker Desktop will exit. <br>OR <br>An error occurred: Required Windows feature(s) not enabled: Containers. Docker Desktop will exit.

Hyper-V and Container Message

Container Message

RESOLUTION

As these messages state, you need to enable the noted Windows features. This can be accomplished manually by launching Turn Windows Features On or Off or via the following PowerShell script.

Turn Windows Features on or off

Write-Host "Runnng this script will install/enable the optional Windows features of Hyper-V and Containers."
Write-Host "After the Windows features are enabled this script will force a system reboot." ForegroundColor Magenta
if($(Get-WindowsOptionalFeature FeatureName MicrosoftHyperV Online).State -ieq 'disabled')
{
Write-Host "Installing Microsoft Hyper V feature." ForegroundColor DarkCyan
Enable-WindowsOptionalFeature Online FeatureName MicrosoftHyperV All NoRestart
}
if($(Get-WindowsOptionalFeature FeatureName Containers Online).State -ieq 'disabled')
{
Write-Host "Installing Containers feature." ForegroundColor DarkCyan
Enable-WindowsOptionalFeature Online FeatureName Containers All NoRestart
}
$confirmation = Read-Host "A restart is required for the changes to take effect. Restart now (y/n)?"
if ($confirmation -ieq 'y') {
Restart-Computer Force
}
else {
Write-Host "At a time convenient to you, restart the machine for the changes to take effect."
}

Image is Incompatible

ERROR: a Windows version 10.0.18363-based image is incompatible with a 10.0.18362 host

RESOLUTION

This message is an indication that your local system is not updated to a minimum of Windows 10 build version 1909. Please update your system and try again.

Running Scripts Is Disabled

…cannot be loaded because running scripts is disabled on this system.

script policy error

RESOLUTION

The scripts used are unsigned, so you will need to ensure your execution policy is set accordingly

  1. Open a PowerShell prompt as ADMIN
  2. Run the following at the prompt
Set-ExecutionPolicy -ExecutionPolicy Unrestricted

Slow System Boot (Reboot) Time

If you are not regularly using Docker, and your boot times feel slow it is recommended to disable Docker to start on boot.

  1. Go to the Notification Tray and click the whale (Docker icon)

docker icon

  1. From the menu options click Settings

Settings

  1. From the settings window, uncheck Start Docker Desktop when you log in

Start Option

Virtual Machine could not be started

If you are attempting to run Docker on/within a VM, you may receive messages similar to the following when you go to run an image.

ERROR: for docker_solr_1 Cannot start service solr: hcsshim: CreateComputeSystem <hash value of the container>: The virtual machine could not be started because a required feature is not installed.

RESOLUTION

Not all the windows features have been enable for your virtual machine as well as on the host to support virtualization within virtualization

  1. Shutdown the VM Client Machine
  2. Ensure the Hyper-V Windows feature on Host Machine is enabled, either manually or via the script (see above).
  3. On the Host Machine set the VM Processor to expose virtualization extensions via a PowerShell
Set-VMProcessor -VMName "<Your Virtual Machine Name>" -ExposeVirtualizationExtensions $true
  1. Start the VM Client Machine
  2. On the VM Client Machine enable the Hyper-V Windows feature, either manually or via the script demonstrated above.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.