Get memory limit in docker file?

Is it possible to get maximum docker container memory at runtime?

What I want to achieve:

docker run --memory "100m" 

and access the maximum memory in the docker file:

 ENTRYPOINT ["java", "-Xmx$memory", "-jar", "helloworld.jar"] 
+2
source share
1 answer

Do not think that you can still specify memory limits in the Docker file. So the way to do this is to override entrypoint on the command line:

 $ docker run -i -t --memory "100m" --entrypoint "java -Xmx100m -jar helloworld.jar" example/java-hello 
+3
source

Source: https://habr.com/ru/post/1239801/


All Articles