在docker文件中获取内存限制? [英] Get memory limit in docker file?
本文介绍了在docker文件中获取内存限制?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想要实现的是:
docker run --memory100m
并访问docker文件中的最大内存:
ENTRYPOINT [java,-Xmx $ memory, - jar,helloworld.jar]
解决方案
t认为您可以在Dockerfile中指定内存限制。所以这样做的方法是在命令行中覆盖你的 entrypoint
:
$ docker run -i -t --memory100m--entrypointjava -Xmx100m -jar helloworld.jarexample / java-hello
Is it possible to get the max memory of a docker container at runtime?
What I want to achieve is:
docker run --memory "100m"
and access the max memory in the docker file:
ENTRYPOINT ["java", "-Xmx$memory", "-jar", "helloworld.jar"]
解决方案
Don't think you can specify memory constraints in the Dockerfile yet. So the way to do it is to override your entrypoint
at the command line:
$ docker run -i -t --memory "100m" --entrypoint "java -Xmx100m -jar helloworld.jar" example/java-hello
这篇关于在docker文件中获取内存限制?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文