Bird
0
0

What is the effect of running this command?

medium📝 Command Output Q13 of 15
Docker - Security
What is the effect of running this command?
docker run --user 1001 alpine id
AShows the user ID 1001 inside the container
BRuns the container as root user
CFails because user 1001 does not exist
DShows the container's hostname
Step-by-Step Solution
Solution:
  1. Step 1: Understand the --user flag

    The --user 1001 option runs the container process as user ID 1001 instead of root.
  2. Step 2: Analyze the command output

    The id command inside the container prints the current user info, so it will show UID=1001.
  3. Final Answer:

    Shows the user ID 1001 inside the container -> Option A
  4. Quick Check:

    --user 1001 + id = UID 1001 [OK]
Quick Trick: --user sets UID; id shows current user info [OK]
Common Mistakes:
  • Assuming container runs as root despite --user
  • Thinking id shows hostname
  • Believing command fails if user not in /etc/passwd

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Docker Quizzes