300-910 · Question #27
Which method is a safe way to provide a username/password combination to an application running as a service in a Docker container?
The correct answer is D. Docker secrets. The question asks for the most secure method to supply sensitive credentials, such as a username and password, to an application running within a Docker container.
Question
Options
- Aencode the value with base64 in a secure DNS CTEXT entry
- Bas an environment variable in the Dockerfile
- CDocker environment variable
- DDocker secrets
How the community answered
(29 responses)- A3% (1)
- B3% (1)
- D93% (27)
Why each option
The question asks for the most secure method to supply sensitive credentials, such as a username and password, to an application running within a Docker container.
Encoding values in DNS CTEXT entries is not a standard, secure, or scalable method for storing application credentials.
Storing environment variables directly in a Dockerfile makes them visible in the image history and can expose them during image inspection, making this an insecure practice.
Docker environment variables, even passed via 'docker run -e', are less secure than Docker Secrets because they can be easily inspected using 'docker inspect' and may be stored in shell history or logs.
Docker Secrets is the recommended and safest way to manage sensitive data like passwords, API keys, or certificates for Docker Swarm services or standalone containers. Secrets are stored securely, encrypted in transit and at rest, and only mounted into the container's filesystem as an in-memory file at runtime, avoiding exposure in environment variables or image layers.
Concept tested: Docker secret management
Source: https://docs.docker.com/engine/swarm/secrets/
Topics
Community Discussion
No community discussion yet for this question.