I'm trying to build a Net8 AOT project with trimming. I get "ERROR: Container build returned 125" 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.
I don't get this error building locally (32GB dev machine).
Is there a trick for running AOT trimming on Bitbucket?
Build log:
dotnet lambda package -c Release Lambda.zip
Found /etc/os-release
Found /etc/os-release
Executing publish command
Starting container for native AOT build using build image: public.ecr.aws/sam/build-dotnet8:latest-x86_64.
... 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
... docker run: Unable to find image 'public.ecr.aws/sam/build-dotnet8:latest-x86_64' locally
... docker run: latest-x86_64: Pulling from sam/build-dotnet8
... docker run: 2537a3b71252: Pulling fs layer
... lots of docker pull messages
... docker run: ed830c6c8e6a: Pull complete... docker run: Digest: sha256:bda53ca8bccf837ebf9073ed984db1b57ba02be4f31cf75ba6f87bff7a43052c
... docker run: Status: Downloaded newer image for public.ecr.aws/sam/build-dotnet8:latest-x86_64
... docker run: Determining projects to restore...
... docker run: Restored /tmp/source/src/Lambda/Lambda.csproj (in 5.14 sec).
... docker run: Lambda -> /tmp/source/src/Lambda/bin/Release/net8.0/linux-x64/Lambda.dll
... docker run: Generating native code
... docker run:
... lots of trim warnings
... docker run: time="2025-05-29T15:50:33Z" level=error msg="error waiting for container: unexpected EOF"
ERROR: Container build returned 125
Hi neilscales,
May I know if you are executing this on self-hosted runners or just on regular Atlassian infrastructure?
I'd suggest the following FAQ troubleshooting article as a first step:
Cheers!
- Ben (Bitbucket Cloud Support)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.