问题
I want to set GOOGLE_APPLICATION_CREDENTIALS inside my docker container using my key.json
file but I don't want to copy this file into my container.
回答1:
If you want to set credentials using docker run, you can supply the file with the --env-file flag, or supply the arguement with --env
The tricky part is, since it's in json, you would have to cat the json file, grep the variable you're looking for, replace the colon with =, and remove the brackets. That's a lot of work.
Instead, why don't you just create file, inside the file use key = value notation, and supply the file with:
docker run --env-file my_config_file ....
来源:https://stackoverflow.com/questions/57137863/set-google-application-credentials-in-docker