Bird
0
0

You want to run multiple containers on a server with 4 CPU cores and 8GB RAM. How should you set resource limits to keep the system stable?

hard📝 Best Practice Q15 of 15
Docker - Resource Management
You want to run multiple containers on a server with 4 CPU cores and 8GB RAM. How should you set resource limits to keep the system stable?
ADo not set any limits and rely on Docker to manage resources automatically
BAssign each container a CPU limit of 1 core and memory limit of 2GB
CSet CPU limit to 4 cores and memory to 8GB for each container
DGive each container unlimited CPU and memory to maximize performance
Step-by-Step Solution
Solution:
  1. Step 1: Calculate fair resource distribution

    With 4 cores and 8GB RAM, dividing resources evenly means 1 core and 2GB per container if running 4 containers.
  2. Step 2: Understand why limits matter for stability

    Setting limits prevents any container from using all resources, keeping the system responsive and stable.
  3. Final Answer:

    Assign each container a CPU limit of 1 core and memory limit of 2GB -> Option B
  4. Quick Check:

    Even resource limits = system stability [OK]
Quick Trick: Divide total resources fairly among containers [OK]
Common Mistakes:
  • Giving unlimited resources causing overload
  • Setting limits higher than host capacity
  • Not setting limits and risking crashes

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Docker Quizzes