<span>I'm trying to build a Net8 AOT project with trimming. I get "<strong>ERROR: Container build returned 125" </strong>at the end. I presume this is some sort of out of memory message because if I disable trimming it builds. I have the build size set to 8x (also tried 16x) but it always fails.</span><span>I don't get this error building locally (32GB dev machine). </span><span>Is there a trick for running AOT trimming on Bitbucket?</span>
<span>Build log:</span>
dotnet lambda package -c Release Lambda.zip
Amazon Lambda Tools for .NET Core applications (5.12.4)
<span>Found /etc/os-release</span>
<span>Executing publish command</span>
<span>Starting container for native AOT build using build image: public.ecr.aws/sam/build-dotnet8:latest-x86_64.</span>
<span>... invoking 'docker run --name tempLambdaBuildContainer-848be619-a29e-4e11-9b8e-2e660c9f3c7e --rm --volume "/opt/atlassian/pipelines/agent/build":/tmp/source/ -i public.ecr.aws/sam/build-dotnet8:latest-x86_64 dotnet publish "/tmp/source/src/Lambda" --output "/tmp/source/src/Lambda/bin/Release/net8.0/publish" --configuration "Release" --framework "net8.0" /p:GenerateRuntimeConfigurationFiles=true --runtime linux-x64 --self-contained True /p:StripSymbols=true' from directory /opt/atlassian/pipelines/agent/build</span>
<span>... docker run: Unable to find image 'public.ecr.aws/sam/build-dotnet8:latest-x86_64' locally</span>
<span>... docker run: latest-x86_64: Pulling from sam/build-dotnet8</span>
<span>... docker run: 2537a3b71252: Pulling fs layer</span>
... lots of docker pull messages
... docker run: ed830c6c8e6a: Pull complete
<span>... docker run: Digest: sha256:bda53ca8bccf837ebf9073ed984db1b57ba02be4f31cf75ba6f87bff7a43052c</span>
<span>... docker run: Status: Downloaded newer image for public.ecr.aws/sam/build-dotnet8:latest-x86_64</span>
<span>... docker run: Determining projects to restore...</span>
<span>... docker run: Restored /tmp/source/src/Lambda/Lambda.csproj (in 5.14 sec).</span>
<span>... docker run: Lambda -> /tmp/source/src/Lambda/bin/Release/net8.0/linux-x64/Lambda.dll</span>
<span>... docker run: Generating native code</span>
<span>... docker run: </span>
<span>... lots of trim warnings</span>
<span>... docker run: time="2025-05-29T15:50:33Z" level=error msg="error waiting for container: unexpected EOF"</span>
ERROR: Container build returned 125<span>Found /etc/os-release</span>