Exactly! I’ve been in situations where flexibility was key, and using environment variables in Docker containers is the best way to go. Instead of hardcoding sensitive info, I pass environment variables during the docker run using the --env or -e flag, like so:
docker run --env DB_CONN="db_connection_string" myapp
This way, you don’t have to reconfigure your Dockerfile. And if you’ve got several variables to handle, it’s even better to use an env file with --env-file. That method keeps everything neat and secure by managing sensitive information outside the image itself.