Câu hỏi phỏng vấn Docker
Câu hỏi

When you limit the memory for a container...

Câu trả lời

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:

  1. 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].

  2. 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

senior

Gợi ý câu hỏi phỏng vấn

middle

What is the default CPU limit set for a container?

junior

What is Docker image?

junior

What does Containerization mean?

Bình luận

Chưa có bình luận nào

Chưa có bình luận nào