Skip to content

Instantly share code, notes, and snippets.

@Voronenko
Created December 14, 2020 14:10
Show Gist options
  • Save Voronenko/9f6cb5427fb55e4b740523c0c45994cb to your computer and use it in GitHub Desktop.
Save Voronenko/9f6cb5427fb55e4b740523c0c45994cb to your computer and use it in GitHub Desktop.
Basic illustration of docker support in jdk 11 container
docker run -it openjdk:11-jdk bash
root@3411b7f04046:/# java -XX:+PrintFlagsFinal -version | grep ContainerSupport
bool UseContainerSupport = true {product} {default}
root@3411b7f04046:/# jshell
jshell> Runtime.getRuntime().availableProcessors()
$1 ==> 8
jshell> Runtime.getRuntime().totalMemory()
$2 ==> 264241152
$ docker run -it --cpus 2 --memory 1G openjdk:11-jdk
jshell> Runtime.getRuntime().availableProcessors()
$1 ==> 2
jshell> Runtime.getRuntime().totalMemory()
$2 ==> 16252928
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment