Setting CPU and memory reservations

For a Swarm example, we will go back to our AtSea custom web application deployment and add a reservation and limit to the appserver service. The appserver service is running a spring boot application in a Java 8 environment. So, we have a couple of things to contend with in this situation. The first is related to a version of Java prior to Java 10, where the JVM disregarded the container's cgroup memory restrictions. As a result, the JVM behaved as though all of the host's memory was available to the JVM, instead of what was allocated to the container through cgroup. This would usually cause the JVM to allocate memory beyond the container limit and to cause the container to fail with an OOME. So to work ...

Get Mastering Docker Enterprise now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.