Historically, HotSpot had poor record running in docker containers misjudging the resources allocated (for example RAM). However, things are slowly improving.
How is OpenJ9 aligned with docker containers and to what extent it is aware of the container-provided resources (memory, sockets, threads, etc.)
Also, during the JavaOne 2017 presentation it was mentioned that OpenJ9 can cache jit-compiled classes across different OpenJ9 VMs. Is this shared cache possible when the VMs are confined to different containers (or) if the containerized JVMs share a docker volume?
With regards to the Shared Class Cache (SCC), both scenarios are possible. Please see "Using the Class Data Sharing feature" from here for an example of sharing a docker volume. When the JVMs are confined to different containers with no shared volume, it is recommended to build the docker container with the SCC pre-built. You dockerfile will look like this.
FROM adoptopenjdk/openjdk9-openj9:x86_64-alpine-jdk-9.181
RUN mkdir /opt/shareclasses && mkdir /opt/app
COPY japp.jar /opt/app
CMD ["java", "-Xshareclasses:cacheDir=/opt/shareclasses", "-jar", "/opt/app/japp.jar"]
You would then need to build and run the image and commit the resultant container and make that as your base image.
docker build -t japp:latest .
docker run japp
docker commit container_id japp