Bitbucket Pipelines OOM with Gradle 7.4, works with Gradle 7.2

When my Dockerfile uses:

FROM gradle:7.4-jdk11 as builder

I get the bitbucket-pipelines error:

Step 5/11 : RUN gradle test build
 ---> Running in fdbd8635d965
[0.008s][warning][os,thread] Failed to start thread - pthread_create failed (EPERM) for attributes: stacksize: 1024k, guardsize: 4k, detached.
#
# There is insufficient memory for the Java Runtime Environment to continue.
# Cannot create worker GC thread. Out of system resources.
# An error report file with more information is saved as:
# /app/hs_err_pid7.log
The command '/bin/sh -c gradle test build' returned a non-zero code: 1
make: *** [Makefile:8: docker-build] Error 1

I cranked up memory settings in my bitbucket-pipelines.yml file:

image: atlassian/default-image:3

options:
  size: 2x

definitions:
  services:
    docker:
      memory: 7128

pipelines:
  default:
    - step:
        services:
          - docker
        script:
          - make docker-build

          - pipe: atlassian/aws-ecr-push-image:1.5.0
            variables:
              AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
              AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
              AWS_DEFAULT_REGION: $AWS_DEFAULT_REGION
              IMAGE_NAME: $PROJECT_NAME
              TAGS: ${BITBUCKET_COMMIT::7}

it doesn’t help, I still get the error.

when I downgrade to gradle:7.2-jdk11 it works. I have a reasonable small Java project and a simple Gradle build config. Ideally, I’d like to be using the latest Gradle with the latest fixes and support for the latest JDK. Gradle 7.2 is sufficient for now, but eventually, I will need to use a newer version.

Is there anything else I can try to get the latest Gradle build image working? Is this a known issue? Thanks!

Gradle does not maintain this image. Report issues to GitHub - keeganwitt/docker-gradle: Docker images with Gradle