100+ times slower builds when having multiple gradle jobs running at once

I have gradle jobs (v7.6.2) that are running in Jenkins in a docker container environment.

When for example 3 different gradle jobs are running in parallel there are extreme slowdowns of the gradle builds, going from 3 seconds when no other Jenkins executors are running into 5 minutes when there are multiple executors running.

I tried making a build scan and it shows that a lot of time is spent between scripts during configuration:

build.gradle Script 3.755s (2m 15.842s total) Applied to 1 project 2022 tasks created

or this

:commons:math 0.001s (0.382s total)

Turning on --info I see the log filling up with occasional batches of something that look like cache conflicts:

Invalidating in-memory cache of ~/.gradle/caches/journal-1/file-access.bin

Should I not be running multiple gradle processes in the same machine at once or is there something else I can do to avoid the cache conflicts?