Bird
0
0

You want to run a container with the SYS_TIME capability but accidentally use this command:

medium📝 Troubleshoot Q14 of 15
Docker - Security
You want to run a container with the SYS_TIME capability but accidentally use this command:
docker run --cap-drop SYS_TIME myimage

What is the problem and how to fix it?
AProblem: Syntax error in command. Fix: Remove <code>--cap-drop</code>
BProblem: SYS_TIME is dropped, so container can't change time. Fix: Use <code>--cap-add SYS_TIME</code>
CProblem: Container runs with full privileges. Fix: Add <code>--cap-drop ALL</code>
DProblem: SYS_TIME is not a valid capability. Fix: Use a valid capability name
Step-by-Step Solution
Solution:
  1. Step 1: Understand the effect of --cap-drop SYS_TIME

    This removes the SYS_TIME capability, preventing the container from changing system time.
  2. Step 2: Correct the command to add the capability

    To allow changing time, use --cap-add SYS_TIME instead of dropping it.
  3. Final Answer:

    Problem: SYS_TIME is dropped, so container can't change time. Fix: Use --cap-add SYS_TIME -> Option B
  4. Quick Check:

    Drop removes, add grants capabilities [OK]
Quick Trick: Add needed caps, don't drop them by mistake [OK]
Common Mistakes:
  • Confusing --cap-drop with --cap-add
  • Assuming dropping caps grants them
  • Thinking SYS_TIME is invalid capability

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Docker Quizzes