Bird
0
0

You tried to limit a container's memory with docker run --memory500m myimage but it did not work. What is the error?

medium📝 Troubleshoot Q6 of 15
Docker - Resource Management
You tried to limit a container's memory with docker run --memory500m myimage but it did not work. What is the error?
AThe flag '--memory' is not valid in Docker run commands
BThe memory limit must be specified in bytes, not megabytes
CThe image name must come before the flags
DThe flag is missing an '=' sign; correct is '--memory=500m'
Step-by-Step Solution
Solution:
  1. Step 1: Check Docker run flag syntax

    Docker requires flags with values to use '=' sign, e.g., '--memory=500m'.
  2. Step 2: Identify syntax error in command

    The command uses '--memory500m' without '=', which is invalid syntax.
  3. Final Answer:

    The flag is missing an '=' sign; correct is '--memory=500m' -> Option D
  4. Quick Check:

    Flag syntax requires '=' sign [OK]
Quick Trick: Use '=' between flag and value in Docker run [OK]
Common Mistakes:
  • Omitting '=' sign in flags
  • Using wrong units for memory
  • Placing image name before flags

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Docker Quizzes