When you limit the memory for a container...
When you limit the memory for a container...
When you limit the memory for a Docker container using the --memory
flag, it does not reserve or guarantee that amount of memory for the container. Instead, it sets a hard limit on the maximum amount of memory the container can use. This means the container cannot exceed this limit, but it does not ensure that the specified amount of memory is exclusively reserved for the container's use.
To clarify, Docker provides two main options for managing memory:
Memory Limit (--memory
): This sets a hard limit on the amount of memory a container can use. If the container tries to use more memory than this limit, it will be terminated by the kernel with an out-of-memory (OOM) error. This does not reserve the memory; it only restricts the container from exceeding the specified limit[5][6].
Memory Reservation (--memory-reservation
): This sets a soft limit, which is a baseline amount of memory that Docker tries to ensure is available for the container. However, this is not a guarantee. The container can exceed this limit if there is no memory contention on the host. The r...
senior
Gợi ý câu hỏi phỏng vấn
Chưa có bình luận nào