Docker on Windows: Compiler Runs Out of Heap Space in Containerized Build Environment

## Context

Our jenkins server (windows server I think) is using a windows Docker image to create a build environment to compile our windows applications.

FROM 192.168.226.153:8081/docker-images/external-base/windows:1809-KB4592440

So far, everything works

## The problem

I am trying to use this Docker Image on my Windows 11 professional desktop, using Docker Desktop for windows. I can run the command to compile from inside the container *C:\Python38\Scripts\scons.exe --site-dir=C:\3rdParty\devTool\site_scons --pkgroot=C:\3rdParty -j8*, but during the compilation, I have these kind of errors :

c:\3rdparty\3rdpartypackages\boost-1.68.0_vs2017\include\boost\spirit\home\qi\auxiliary\eps.hpp(90): fatal error C1060: compiler is out of heap space
c:\3rdparty\3rdpartypackages\boost-1.68.0_vs2017\include\boost\spirit\home\qi\directive\omit.hpp(104): fatal error C1060: compiler is out of heap space
c:\3rdparty\3rdpartypackages\boost-1.68.0_vs2017\include\boost\function_types\detail\components_impl\arity20_1.hpp(84): fatal error C1060: compiler is out of heap space
c:\3rdparty\3rdpartypackages\boost-1.68.0_vs2017\include\boost\spirit\home\qi\directive\omit.hpp(54): fatal errorC1060: compiler is out of heap space

I don’t understand because the spec of the computer is high :

  • 12th generation I9-12900
  • 32 gig of ram
  • 16 core
  • 24 logical core

## What I tried

  • The same Windows 11 machine that hosts the problematic container successfully completes the compilation process when I set up the build environment locally.
  • Additionally, an older Windows 10 computer also manages to compile without any issues when the build environment is installed directly on it.

## Questions

  • I’m experiencing an issue with my compilation process inside a Docker container on my Windows 11 machine, which isn’t occurring on the Jenkins server. There seems to be a misunderstanding on my part regarding Docker’s resource allocation for containers.
  • Additionally, I’ve noticed a discrepancy in the behavior of the scons.exe -j8 command when executed inside and outside the container. Outside the container, it’s evident that multiple CPUs are in operation. However, when the command is run from within the container, I can’t observe the same level of CPU activity.
  • Furthermore, after running the scons.exe -j8 command within the container 2-3 times, it appears that the container freezes entirely. The only workaround I’ve found to exit the container is to initiate a computer restart!
  • Could it be possible that I am pushing the intended use of containers beyond their intended capacity or functionality?