Passing default Google app credentials when running local docker

Is there a way to pass my local default app credentials for google ( https://developers.google.com/identity/protocols/application-default-credentials ) via docker launch?

My Information:

  • Code executed locally on my machine correctly processes default application credentials
  • Code running in a docker image on a GCE instance also correctly processes application credentials by default
  • The problem is “running dockers” on my machine. The code running in the docker container does not use the default application credentials for the host.

It would be nice if I could say that "docker run" passed the default google host app credentials for the docker image.

+4
source share
1 answer

The transfer -v ~/.config:/root/.configshould make it work. This assumes that your local code uses the default credentials for the application stored gcloud auth loginin ~ / .config / gcloud, and that the user's home directory is in the / root container.

+8
source

Source: https://habr.com/ru/post/1651190/


All Articles