Skip to content

Instantly share code, notes, and snippets.

@topiaruss
Created December 15, 2016 15:12
Show Gist options
  • Save topiaruss/431f36deadc77b1a3f30e8633c4fdba3 to your computer and use it in GitHub Desktop.
Save topiaruss/431f36deadc77b1a3f30e8633c4fdba3 to your computer and use it in GitHub Desktop.
Java heap constraints in docker-compose
version: '2'
services:
test-java-params-none:
image: iron/java:1.8
command: sh -c " java -XX:+PrintFlagsFinal -version|grep -i heapsize|egrep 'Initial|Max'"
test-java-params-cmd-line:
image: iron/java:1.8
command: sh -c "sleep 2; java -Xms64m -Xmx128m -XX:+PrintFlagsFinal -version|grep -i heapsize|egrep 'Initial|Max'"
test-java-params-from-dot-env:
image: iron/java:1.8
command: sh -c "sleep 4; java ${MEM_OPTS} -XX:+PrintFlagsFinal -version|grep -i heapsize|egrep 'Initial|Max'"
test-java-params-from-shell-env:
image: iron/java:1.8
environment:
- _JAVA_OPTIONS=-Xms64m -Xmx160m
command: sh -c "sleep 6; java -XX:+PrintFlagsFinal -version|grep -i heapsize|egrep 'Initial|Max'"
test-java-params-from-env-file:
image: iron/java:1.8
env_file:
- tight-mem.env
command: sh -c "sleep 8; java -XX:+PrintFlagsFinal -version|grep -i heapsize|egrep 'Initial|Max'"
_JAVA_OPTIONS=-Xms12m -Xmx28m
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment