When it comes to Java, over the past few years, there have been a number of attempts to get Java working in Docker in a good way. Currently, the official Docker image for Java is based on OpenJDK: https://hub.docker.com/_/openjdk/. We will use Java SE 12 with the Docker tag openjdk:12.0.2, that is, Java SE v12.0.2.Â
Java has historically not been very good at honoring the quotas specified for a Docker container using Linux cgroups; it has simply ignored these settings. So, instead of allocating memory inside the JVM in relation to the memory available in the container, Java allocated memory as if it had access to all the memory in the Docker host, which obviously isn't good! In the same way, Java allocated CPU-related resources such as thread pools in relation to the total number of available CPU cores in the Docker host...