Bird
0
0

Given the following Docker service creation command:

medium📝 Command Output Q13 of 15
Docker - Security
Given the following Docker service creation command:
docker service create --name myapp --secret db_password nginx

What happens to the secret db_password inside the running container?
AIt is stored as an environment variable named DB_PASSWORD
BIt is printed in the container logs
CIt is mounted as a file in <code>/run/secrets/db_password</code>
DIt is embedded inside the container image
Step-by-Step Solution
Solution:
  1. Step 1: Understand how Docker secrets are exposed

    Docker secrets are mounted as files inside the container at /run/secrets/[secret_name].
  2. Step 2: Analyze the options

    It is mounted as a file in /run/secrets/db_password correctly states the secret is mounted as a file. Options A, B, and D are incorrect because secrets are not environment variables, not printed in logs, and not embedded in images.
  3. Final Answer:

    It is mounted as a file in /run/secrets/db_password -> Option C
  4. Quick Check:

    Secrets = files in /run/secrets [OK]
Quick Trick: Secrets appear as files in /run/secrets inside containers [OK]
Common Mistakes:
  • Thinking secrets become environment variables automatically
  • Expecting secrets to be logged
  • Assuming secrets are inside the image

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Docker Quizzes