It might look like a challenge to run Java in Docker environment, by default Java is not aware of Docker memory limits. Check this article for example – Java inside docker: What you must know to not FAIL. I was able to run WebLogic and ADF (Essential WebLogic Tuning to Run on Docker and Avoid OOM) on Docker previously without Java memory issues, using JAVA_OPTIONS=-XX:+UnlockCommercialFeatures -XX:+ResourceManagement -XX:+UseG1GC. However after Docker upgrade to latest version, these settings didn’t help anymore. I did’t want to hardcode memory setting with -Xmx.
Java started to consume all available memory in Docker and eventually was killed. You can see this from chart below – memory is growing, killed and after restart growing again:
To solve this behaviour, I have applied settings from Java Platform Group, Product Management Blog – Java SE support for Docker CPU and memory limits. I have replaced JAVA_OPTIONS=-XX:+UnlockCommercialFeatures -XX:+ResourceManagement -XX:+UseG1GC set previously with JAVA_OPTIONS=-XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap -XX:+UseG1GC.
JAVA_OPTIONS=-XX:+UnlockExperimentalVMOptions – XX:+UseCGroupMemoryLimitForHeap -XX:+UseG1GC did the job – JVM stays in Docker memory limits sharp: Read the complete article here.
For regular information become a member in the WebLogic Partner Community please visit: http://www.oracle.com/partners/goto/wls-emea ( OPN account required). If you need support with your account please contact the Oracle Partner Business Center.