Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google gsutil auth without prompt

I want to use gsutil inside a Docker container. I have created an O2Auth Service Account JSON file.

How can I setup gsutil auth to use the JSON config file and execute commands without prompting?

Currently I get something like this:

$ gsutil config -e
It looks like you are trying to run "/.../google-cloud-sdk/bin/bootstrapping/gsutil.py config".
The "config" command is no longer needed with the Cloud SDK.
To authenticate, run: gcloud auth login
Really run this command? (y/N) y
This command will create a boto config file at /.../.boto
containing your credentials, based on your responses to the following questions. 
What is the full path to your private key file? 

What command/parameters/setup do I have to use to circumstance prompts?

like image 380
blacklabelops Avatar asked Dec 15 '22 12:12

blacklabelops


1 Answers

Solved this issue by executing:

gcloud auth activate-service-account --key-file=/opt/gcloud/auth.json

The whole example and finished container can be found here: blacklabelops/gcloud

like image 51
blacklabelops Avatar answered Jan 12 '23 14:01

blacklabelops