Docker and CI/CD · Junior · Question 31 of 75
How do you pass an environment variable when starting a container?
- 1
docker build API_URL=https://api.example.com my-app - ✓Correct answer:
docker run -e API_URL=https://api.example.com my-app - 3
docker run --var API_URL=https://api.example.com my-app
Explanation
-e sets one variable and --env-file .env loads many. Configuration from the environment lets the same image run in every environment.