Search code examples
javaamazon-web-servicesaws-cloudformationamazon-ecsjvm-arguments

java vm options and AWS::ECS::TaskDefinition


I would like to run my docker container as following:

 docker run java \
  -XX:+UnlockExperimentalVMOptions \
  -XX:+UseCGroupMemoryLimitForHeap 

Where should I pass vm arguments when writing AWS::ECS::TaskDefinition in cloudformation stack?


Solution

  • I have done the same thing at work, you could pass the flags directly in Dockerfile as per below.

    ENV JAVA_OPTS="-XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap"
    ENTRYPOINT [ "sh", "-c", "java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -jar /app.jar" ]