Q. Which role has access to secrets on a Docker Swarm manager node?

  • (A) Any Docker user
  • (B) Only root
  • (C) Only the Docker daemon
  • (D) Docker group users
πŸ’¬ Discuss
βœ… Correct Answer: (C) Only the Docker daemon
Explanation: Only the Docker daemon has access to secrets stored on a Swarm manager node.

Q. How do you provide multiple secrets to a service in Docker?

  • (A) Use a comma-separated list
  • (B) Add multiple `--secret` flags
  • (C) Use a secrets bundle
  • (D) Use a YAML config file
πŸ’¬ Discuss
βœ… Correct Answer: (B) Add multiple `--secret` flags
Explanation: Each secret is added to a service using a separate `--secret` flag.

Q. Can secrets be shared across multiple services in Docker?

  • (A) Yes, without restriction
  • (B) Only if they are redefined
  • (C) Yes, if explicitly attached to each service
  • (D) No, secrets are service-specific
πŸ’¬ Discuss
βœ… Correct Answer: (C) Yes, if explicitly attached to each service
Explanation: Secrets can be reused by different services if explicitly attached to each.

Q. Can secrets be accessed by a non-root user inside the container?

  • (A) Yes, if the user has read permission
  • (B) No, secrets are always root-only
  • (C) Yes, via environment variables
  • (D) No, they must be copied manually
πŸ’¬ Discuss
βœ… Correct Answer: (A) Yes, if the user has read permission
Explanation: Secrets have 0400 permission, so any user who can read the file may access it.

Q. What file system do secrets use inside containers?

  • (A) ext4
  • (B) tmpfs
  • (C) overlay2
  • (D) aufs
πŸ’¬ Discuss
βœ… Correct Answer: (B) tmpfs
Explanation: Docker secrets are mounted using a tmpfs in-memory filesystem for security.

Q. Which YAML section in Docker Compose is used to declare secrets?

  • (A) configs
  • (B) volumes
  • (C) secrets
  • (D) files
πŸ’¬ Discuss
βœ… Correct Answer: (C) secrets
Explanation: In Docker Compose, secrets are declared in the `secrets` section.

Q. How do you assign a secret to a service in Docker Compose?

  • (A) Under the `volumes` key
  • (B) Under the `env_file` key
  • (C) Under the `secrets` key inside the service
  • (D) With the `command` key
πŸ’¬ Discuss
βœ… Correct Answer: (C) Under the `secrets` key inside the service
Explanation: You assign secrets under the `secrets` key inside a service definition.

Q. What is the main advantage of Docker secrets over environment variables?

  • (A) They use more memory
  • (B) They are easier to manage
  • (C) They are encrypted and not exposed via `docker inspect`
  • (D) They are visible in logs
πŸ’¬ Discuss
βœ… Correct Answer: (C) They are encrypted and not exposed via `docker inspect`
Explanation: Unlike environment variables, secrets are secure and not visible in container inspection output.

Q. What is the purpose of Docker configs?

  • (A) To store encrypted passwords
  • (B) To manage application source code
  • (C) To store non-sensitive configuration data
  • (D) To log container output
πŸ’¬ Discuss
βœ… Correct Answer: (C) To store non-sensitive configuration data
Explanation: Docker configs are used to manage non-sensitive configuration data like config files and settings.

Q. Which Docker mode is required to use Docker configs?

  • (A) Standalone mode
  • (B) Compose mode
  • (C) Swarm mode
  • (D) Bridge mode
πŸ’¬ Discuss
βœ… Correct Answer: (C) Swarm mode
Explanation: Docker configs are only available when running services in Docker Swarm mode.