Set GOOGLE_APPLICATION_CREDENTIALS in Docker

喜夏-厌秋 提交于 2020-01-03 17:20:25

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!