Bird
0
0

Which of the following is the correct Docker command syntax to limit a container's memory to 256MB?

easy📝 Syntax Q3 of 15
Docker - Resource Management
Which of the following is the correct Docker command syntax to limit a container's memory to 256MB?
Adocker run --mem-limit=256MB myimage
Bdocker run --memory=256m myimage
Cdocker run --memory-limit=256 myimage
Ddocker run --mem=256m myimage
Step-by-Step Solution
Solution:
  1. Step 1: Recall correct memory limit flag

    The correct flag to limit memory is --memory followed by the size with unit.
  2. Step 2: Check syntax correctness

    docker run --memory=256m myimage uses --memory=256m which is valid syntax. Other options use incorrect flags or units.
  3. Final Answer:

    docker run --memory=256m myimage -> Option B
  4. Quick Check:

    Memory limit flag = --memory [OK]
Quick Trick: Use --memory=256m to limit memory to 256MB [OK]
Common Mistakes:
  • Using incorrect flag names like --mem-limit
  • Omitting units or using wrong units
  • Confusing memory limit with CPU limit flags

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Docker Quizzes