Bird
0
0

Given the command:

medium📝 Command Output Q5 of 15
Docker - Resource Management
Given the command:
docker run --memory=500m --memory-reservation=300m myapp
What is the expected behavior if the container tries to use 400MB of memory?
AContainer continues running normally as 400MB is below the hard limit.
BContainer is killed immediately for exceeding the reservation.
CDocker throttles CPU usage but allows memory use.
DContainer is paused until memory usage drops below 300MB.
Step-by-Step Solution
Solution:
  1. Step 1: Identify limits and usage

    Memory limit is 500m (hard), reservation is 300m (soft), usage is 400m.
  2. Step 2: Understand behavior when usage exceeds reservation but below limit

    Container can exceed reservation without being killed; only limit kills.
  3. Final Answer:

    Container continues running normally as 400MB is below the hard limit. -> Option A
  4. Quick Check:

    Usage > reservation but < limit = container runs [OK]
Quick Trick: Soft limit exceeded is allowed; hard limit kills [OK]
Common Mistakes:
  • Thinking container is killed at reservation
  • Confusing CPU throttling with memory limits
  • Assuming container pauses on memory excess

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Docker Quizzes