谷歌gsutil auth没有提示
我想在Docker容器中使用gsutil。 我已经创build了O2Auth服务帐户JSON文件。
我如何设置gsutil身份validation使用JSONconfiguration文件并执行命令而不提示?
目前我得到这样的东西:
$ 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?
我必须使用什么命令/参数/设置来提示情况?
通过执行以下解决此问题:
gcloud auth activate-service-account --key-file=/opt/gcloud/auth.json
整个例子和完成的容器可以在这里find: blacklabelops / gcloud
如果你只想要gsutil并绕过提示,你可以用expect脚本轻松完成:
#!/usr/bin/expect spawn gsutil config -e expect "What is the full path to your private key file?" { send "/path/your.key\r" } expect "Would you like gsutil to change the file permissions for you? (y/N)" { send "y\r" } expect "What is your project-id?" { send "your-projet-42\r" } interact
只使用gsutil:
首先运行该命令手动configurationauthentication
gsutil config -a
这将创build具有所需证书的/root/.boto文件。 将该path/文件复制到您的泊坞窗图像中。
gsutil现在将使用这些凭据。