Ich habe einen Server mit 16GB RAM. Ich versuche, das Speicherlimit für den Container durch Ausführen festzulegen
docker run -it -m 500M <image-name>
In den Docker-Statistiken wird angezeigt, dass der Container das Speicherlimit von 500 MB hat. Aber wenn ich es versuche
docker exec -it <containerID> /bin/sh
und machen Sie ein "top", es zeigt den verfügbaren Speicher als 16 GB an.
Sollte es nicht auf 500 MB eingestellt sein?
Der Hauptgrund, warum ich 500 MB benötige, ist, dass in jedem Container eine Java-Anwendung ausgeführt wird. Und standardmäßig nimmt die JVM 16 GB/64 als Xms und 4 GB als Xmx. :(
Ich denke, dieser Artikel wird Ihnen helfen zu verstehen, warum Free und Top in Containern nicht richtig funktionieren.
Most of the Linux tools providing system resource metrics were created before
cgroups even existed (e.g.: free and top, both from procps). They usually read
memory metrics from the proc filesystem: /proc/meminfo, /proc/vmstat,
/proc/PID/smaps and others.
Unfortunately /proc/meminfo, /proc/vmstat and friends are not containerized.
Meaning that they are not cgroup-aware. They will always display memory
numbers from the host system (physical or virtual machine) as a whole, which
is useless for modern Linux containers
This causes a lot of confusion for users of Linux containers. Why does free
say there is 32GB free memory, when the container only allows 512MB to be
used?
https://fabiokung.com/2014/03/13/memory-inside-linux-containers/
Dieser Artikel stammt aus dem Internet. Bitte geben Sie beim Nachdruck die Quelle an.
Bei Verstößen wenden Sie sich bitte [email protected] Löschen.
Lass mich ein paar Worte sagen