<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[arran.cloud]]></title><description><![CDATA[arran.cloud]]></description><link>https://blog.arran.cloud</link><generator>RSS for Node</generator><lastBuildDate>Mon, 20 Apr 2026 17:33:21 GMT</lastBuildDate><atom:link href="https://blog.arran.cloud/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Docker build not working on a Windows Server virtual machine]]></title><description><![CDATA[TL:DR
If you're using a Windows Server OS on a Hyper-V host to build or run a docker image that uses an older Windows Server base image, you need to enable nested virtualization for the virtual machine on your Hyper-V host and use the --isolation=hyp...]]></description><link>https://blog.arran.cloud/docker-build-not-working-on-a-windows-server-virtual-machine</link><guid isPermaLink="true">https://blog.arran.cloud/docker-build-not-working-on-a-windows-server-virtual-machine</guid><category><![CDATA[Docker]]></category><category><![CDATA[hyper-v]]></category><category><![CDATA[Windows]]></category><category><![CDATA[windows server]]></category><category><![CDATA[Azure Container Instances]]></category><dc:creator><![CDATA[Arran]]></dc:creator><pubDate>Mon, 19 Sep 2022 12:40:57 GMT</pubDate><content:encoded><![CDATA[<h3 id="heading-tldr">TL:DR</h3>
<p>If you're using a Windows Server OS on a Hyper-V host to build or run a docker image that uses an older Windows Server base image, you need to enable nested virtualization for the virtual machine on your Hyper-V host and use the <code>--isolation=hyperv</code> parameter when running the docker build or run command. </p>
<h1 id="heading-using-an-older-windows-server-os-base-image-and-then-building-on-a-windows-server-2022-hyper-v-virtual-machine">Using an older Windows Server OS base image and then building on a Windows Server 2022 Hyper-V virtual machine</h1>
<p>I use a Windows Server 2022 virtual machine as a dev machine, this allows me to use VSCode on any machine and then SSH in to create, run and debug code. The setup works surprisingly well, until recently when I was trying to update a docker image to use the <code>mcr.microsoft.com/windows/servercore:ltsc2019</code> base image. The reason for needing to update the image was because <a target="_blank" href="https://learn.microsoft.com/en-us/azure/container-instances/container-instances-faq#windows-server-2019-and-client-base-images">Azure container instances don't currently support Windows Server 2022 container images</a>. </p>
<h2 id="heading-the-first-error-message-forcing-docker-to-use-hyper-v-and-not-process-isolation">The first error message (forcing docker to use Hyper-V and not process isolation)</h2>
<p>This didn't initially seem like it was going to be a big issue, just a quick single-line change, however, when building the image, I was given the following error... </p>
<pre><code>The container operating <span class="hljs-keyword">system</span> does <span class="hljs-keyword">not</span> match the host operating <span class="hljs-keyword">system</span>.
</code></pre><p>At first, I thought my docker settings may have changed (meaning docker was using Linux containers) but after checking the docker icon in the system tray this wasn't the case. </p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1663582787243/M135RT1jr.png" alt="image.png" /> </p>
<p>After checking my settings, I remembered that containers running on Windows Server behave differently to containers running on Windows 10 and 11. On server editions of Windows, process isolation is used while Windows 10/11 will uses Hyper-V isolation. After reading over <a target="_blank" href="https://learn.microsoft.com/en-us/virtualization/windowscontainers/deploy-containers/version-compatibility?tabs=windows-server-2022%2Cwindows-11-21H2#windows-server-host-os-compatibility">Microsoft's documentation on Windows Server host OS compatibility</a>, Windows Server 2022 can only use process isolation for base images using Windows Server 2022 so to use a Windows Server 2019 base image I'll need to use Hyper-V isolation. </p>
<p>You can <a target="_blank" href="https://learn.microsoft.com/en-us/virtualization/windowscontainers/deploy-containers/version-compatibility?tabs=windows-server-2022%2Cwindows-11-21H2#hyper-v-isolation-for-containers">force docker build and run to use Hyper-V isolation</a> by using the <code>--isolation=hyperv</code> parameter when building or running an image. </p>
<h2 id="heading-the-second-error-message-enabling-nested-virtualization">The second error message (enabling nested virtualization)</h2>
<p>After adding the <code>--isolation=hyperv</code> parameter got a new error message... </p>
<pre><code>The virtual machine could not be started because a <span class="hljs-keyword">required</span> feature <span class="hljs-keyword">is</span> not installed.
</code></pre><p>This initially is a bit of a strange error as my Windows Server 2022 virtual machine already had Hyper-V installed (but I hadn't tried using it yet). Doing some Googling, I came across <a target="_blank" href="https://www.thewindowsclub.com/error-0x80370102-the-virtual-machine-could-not-be-started">a post by the Windows Club</a> which mentioned to 'Enable Nested Virtualization'. This linked me to <a target="_blank" href="https://www.thewindowsclub.com/nested-virtualization-in-windows-10">another article</a> explaining what it was. It turns out that to allow Hyper-V to function within a Hyper-V machine, you need to enable nested virtualization. </p>
<p>Following a link to [a Microsoft article](https://learn.microsoft.com/en-us/virtualization/hyper-v-on-windows/user-guide/nested-virtualization, to enable nested virtualization you need to stop the virtual machine you want to enable it for (in my case this was my Windows Server 2022 VM) and then run the following command on the Hyper-V host (the machine that actually runs the VM): </p>
<pre><code>Set<span class="hljs-operator">-</span>VMProcessor <span class="hljs-operator">-</span>VMName <span class="hljs-operator">&lt;</span>VMName<span class="hljs-operator">&gt;</span> <span class="hljs-operator">-</span>ExposeVirtualizationExtensions $true
</code></pre><h2 id="heading-finally-docker-build-works">Finally docker build works</h2>
<p>After starting up my development machine VM again I ran <code>docker build --isolation=hyperv --no-cache -t my/image:tag .</code> and got another error message... </p>
<pre><code><span class="hljs-attribute">unexpected</span> EOF
</code></pre><p>Reviewing things, docker had decided to update when I was running the build command. So, while the update was happening, I edited the dockerfile around the step where it failed (by removing and then adding the new lines) in notepad. </p>
<p>Once docker had finally finished updating, I ran the same docker build command again and finally my docker image was built successfully. </p>
]]></content:encoded></item></channel></rss>