1
votes

I am trying to run a Docker image through a Google Cloud proxy and despite my best efforts Google Cloud continues giving me this error:

Can't create logging client: google: could not find default credentials. See https://developers.google.com/accounts/docs/application-default-credentials for more information.

Whenever I try to run my Docker image using this command:

sudo docker run dc701c583cdb

I have tried updating my GOOGLE_APPLICATION_CREDENTIALS environment variable to the path of my key file. I have successfully logged in to Google Cloud using the gcloud auth application-default login command. I've defined and associated my project in Google Cloud.

I am attempting this in order to run an open source project. I'm quite sure I created the Docker image correctly. I have a feeling the issue is coming from the fact that I am not correctly connecting the existing project to my Google Cloud.

Any advice would be greatly appreciated. I am using Docker 18.06.1-ce and Google Cloud-SDK 219.0.1. Running on a virtual linux machine with Ubuntu 18.04.

1
A wild guess on my part ... perhaps sudo isn't passing your environment variables through? Perhaps run sudo bash and then try and run the commands in the newly created shell as root. If that works, then maybe a sudo -E option might work where the environment is passed through to the sudo environment.Kolban

1 Answers

1
votes

When running the google/cloud-sdk container from Docker Hub in a newly-created Ubuntu 18.04 instance, the container's gcloud automatically inherits the instance's user configuration. Give it a try: run that container and then run gcloud info inside of it.

As such, I believe you might be doing something wrong. I recommend you take a look at the aforementioned container to see how that can be made to work.