Bird
0
0

What will be the effect of running this command?

medium📝 Command Output Q4 of 15
Docker - Security
What will be the effect of running this command?
docker run --cap-drop NET_ADMIN --cap-add CHOWN alpine id
AThe container will have both NET_ADMIN and CHOWN capabilities.
BThe container will have the CHOWN capability but not NET_ADMIN.
CThe container will have no capabilities at all.
DThe container will fail to start due to conflicting options.
Step-by-Step Solution
Solution:
  1. Step 1: Analyze the capability flags

    The command removes the NET_ADMIN capability and adds the CHOWN capability explicitly.
  2. Step 2: Understand the resulting capabilities

    The container will not have NET_ADMIN but will have CHOWN capability enabled.
  3. Final Answer:

    The container will have the CHOWN capability but not NET_ADMIN. -> Option B
  4. Quick Check:

    --cap-drop removes, --cap-add adds capabilities [OK]
Quick Trick: Use --cap-drop and --cap-add to customize capabilities [OK]
Common Mistakes:
  • Assuming both capabilities remain
  • Thinking container fails to start
  • Believing all capabilities are removed

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Docker Quizzes