Trying to run JVM in Docker Desktop Mac

Hi All,

I’m trying to run a build server for Android on a Mac mini (Mac OS 10.14.6). I’m running Docker Desktop for Mac (2.1.0.5 (40693)).

I inherited an image that has Jenkins installed on it, and the android SDK more-or-less installed. Docker Desktop might have ben installed from homebrew, FWIW.

One of the issues I’m dealing with are seemingly random ‘Out Of Memory’ incidents.

The image had 2GB of Ram, and I’ve bumped it up to 4GB…but that hasn’t changed the crashes much.

I’ve seen a couple articles like:

1) https://medium.com/adorsys/jvm-memory-settings-in-a-container-environment-64b0840e1d9e

2) https://developers.redhat.com/blog/2017/03/14/java-inside-docker/

I understand that the JDK that I have installed cannot know how much memory it really should be having, and that I need to specify that the MaxRAMFraction of 4 shouldn’t be used for the docker instance.

I should specify the memory for the jvm…but both web pages reference a Dockerfile.

So far so good…question is:

if I’m using Docker Desktop for Mac, where’s the relevant Dockerfile?

I can find the image file, but there’s no Dockerfile there.

I’ve also read that Java 10 and Java 11 are smart enough to figure out they’re inside docker and behave…but we haven’t tried a recent Java with the app. We’re currently running ‘openjdk version “1.8.0_212”’. Must I upgrade the java on the machine?

Anyone know the secret to get this running in a more stable way?

Thanks.

-Ken

In case anyone else stumbles across this, for me the answer was to edit the “/.gradle/gradle.properties” file that contains all the environment settings for Gradle.

I added the line:
org.gradle.jvmargs=-Xms2048m -Xmx3096m -XX:+CMSClassUnloadingEnabled

That did the trick. Nothing to do with a Dockerfile, as the builds were actually happening on the machine inside of which the docker container was running.

Simple, in the end, if entirely mind-bending.