MSBuild.exe on Docker Windows Container freezes

Viewed 951

I'm trying to set up a docker container to run Jenkins on our project. The solution contains both C++ and .NET Framework projects. The docker file is leveraged from here here with a couple additional items. One being that I also install the Microsoft.VisualStudio.Workload.VCTools in the BuildTools command.

Everything seems to set up fine and Jenkins finds all the necessary tools needed. But when we go to run the MSBuild plugin, the entire container freezes at linking time. I suspect a memory issue but this happens at the same spot every time. Once it gets into this state though, I have to kill the vmwp process in Task Manager to restart the container as docker commands hang.

The docker command to run the container is:

docker run --name jenkins --hostname jenkins --network nat --publish 8080:8080 --restart=always -d -v C:\Docker\jenkins\volumes\jenkins_home:C:\JENKINS_HOME --storage-opt "size=128GB" -m 16G --cpus=8 company/jenkins:latest

The last command in the jenkins build process before it freezes is Lib.exe with all of the .obj files that were generated. I see the library that was generated on the mounted workspace volume in the appropriate location though.

If I decrease the number of objects going into the .lib, the command works fine. But if I do the full list of objects, it hangs. The command looks like:

"C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.25.28610\bin\Hostx64\x64\lib.exe" /OUT:"C:\JENKINS_HOME\workspace\MyProgram\build\Release\MyLibrary.lib" /NOLOGO /MACHINE:X64 /L TCG C:\JENKINS_HOME\workspace\MyProgram\temp_build\Release\common_interface.obj ...rest of objects...

When trying to compile all the objects, the stats on the docker container:

CONTAINER ID        NAME                CPU %               PRIV WORKING SET    NET I/O             BLOCK I/O
1b219679b4e6        jenkins             0.02%               2.961GiB            2.79MB / 1.43MB     96.7MB / 1.7GB

I ran the MSBuild.exe manually in the docker container and it resulted in the same behavior. I can control-C it which it then responds with "Attempting to cancel the build..." and continues to hang. The docker container memory usage in this instance is 2.2GB (Vmmem in task manager reflects this).

My computer stats:

Processor - i9-9900K
Memory - 32GB
OS - Windows 10 Professional

Any help would be appreciated.

1 Answers

I took the container out of Hyper-V isolation and made it process isolation which is somewhat newly supported for windows and it worked. The flag used on the run command was:

--isolation=process

Curious as to why Hyper-V isolation was causing the container to freeze during the link command...

Related