buildkit icon indicating copy to clipboard operation
buildkit copied to clipboard

[POC] wcow: option to run builds in hyperv isolation

Open profnandaa opened this issue 8 months ago • 6 comments

Add an option to run builds in hyper-v isolation mode for Windows images.

WIP Checklist:

  • [x] Test with basic image runs (works ok)
  • [x] Test with bind and cache mounts (works ok)
  • [ ] Test with CNI capability (this will not work, needs to be documentated)
  • [ ] Discuss which flags to use to expose this, --isolated like in ctr?

Fixes #5682


Basic Test

FROM mcr.microsoft.com/windows/nanoserver:ltsc2022

ENV BUILDKIT_HYPERV_ISOLATED=1

RUN ping -n 30 localhost >nul

When the build is at the RUN stage, on a different terminal, try to run:

> Get-Process ping

# should get this error, since ping is not running on the host
# it's hyper-v isolated:
# Get-Process: Cannot find a process with the name "ping"...

Now try to build the same image with ENV BUILDKIT_HYPERV_ISOLATED=0 or without the env variable, should get something like:

> Get-Process ping

 NPM(K)    PM(M)      WS(M)     CPU(s)      Id  SI ProcessName
 ------    -----      -----     ------      --  -- -----------
      6     0.93       4.21       0.00   25220  32 PING

profnandaa avatar Feb 18 '25 07:02 profnandaa