docker run samples should use --env-file for secrets
See original GitHub issueWe should help our consumers to be secure by default. That means we should not pass secrets via regular environment variables but use --env-file
If we do this, we should also guide them on minimal required config and how to create a file.
Good suggestion by @mabsimms
Examples
Example with Azure Monitor secret in a file
docker run -d -p 8999:80 --name promitor-agent-scraper /
--env PROMITOR_AUTH_APPID='<azure-ad-app-id>' \
--env-file C:/Promitor/az-mon-auth.creds /
--volume C:/Promitor/metric-config.yaml:/config/metrics-declaration.yaml /
tomkerkhove/promitor-agent-scraper:1.0.0-preview-3
Example with all Azure Monitor config in a file
docker run -d -p 8999:80 --name promitor-agent-scraper /
--env-file C:/Promitor/az-mon-auth.creds /
--volume C:/Promitor/metric-config.yaml:/config/metrics-declaration.yaml /
tomkerkhove/promitor-agent-scraper:1.0.0-preview-3
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
What Is the Docker .env File and How Do You Use It?
Docker .env file holds all the sensitive passwords and configuration data so they don't have to be planted in the container itself.
Read more >How to use secrets in Docker Compose
Getting a secret into a container is a two-step process. First, define the secret using the top-level secrets element in your Compose file....
Read more >A complete guide to using environment variables and files ...
The goal of this article is show you the benefits of working with environment variables in Docker and to demonstrate how to do...
Read more >Docker secrets passing as environment variable
Docker Swarm simply lacks good pracitces and proper examples for passing secret to env variable. IMHO best way is to use entrypoint as...
Read more >Inject secrets into Docker containers without exposing them
This guide will help you inject secrets as environment variables into containers at runtime. This means secrets do not have to be baked...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

If I can retrieve credentials from CLI or the file, I’m inherently authorized to do so (aka, I’m already on the other side of the airtight hatchway). The information exposure risk is more about certain conditions where the process start arguments are available to non-elevated contexts.
For example:
👋 @tomkerkhove, verify the status of this issue