Skip to main content

What’s the difference between soft and hard resource limits in Docker?

Mid Docker
Quick Answer Soft limits are advisory รขโ‚ฌโ€ the container can exceed them temporarily (memory soft limit = memory.soft_limit_in_bytes). Hard limits are enforced รขโ‚ฌโ€ the kernel kills processes that exceed them (memory hard limit = memory.limit_in_bytes). Docker's --memory flag sets the hard limit; --memory-reservation sets the soft limit.

Answer

Soft limits may be exceeded temporarily; hard limits cannot be exceeded.
S
SugharaIQ Editorial Team Verified Answer

This answer has been peer-reviewed by industry experts holding senior engineering roles to ensure technical accuracy and relevance for modern interview standards.

Want to bookmark, take notes, or join discussions?

Sign in to access all features and personalize your learning experience.

Sign In Create Account

Source: SugharaIQ

Ready to level up? Start Practice