我试图在我的Dockerfile中包含我的Google存储空间的凭据,这样我每次创建新的Pod或Kubernetes中的其他模块时都不必这样做。 那么有没有办法把这个命令放在这个
gsutil config -a (Access Key) (Secret)
而不是运行命令
gsutil config -a
然后手动插入(访问密钥)和(密码)。
由于
答案 0 :(得分:0)
您可以使用echo
传递输入并将其传递给gsutil
。
请记住为什么gsutil
命令不接受命令行参数 - 命令存储在shell的历史文件中,如果它们包含这些秘密作为命令行参数,则很容易泄露您的秘密。
因此,以下命令将存储在shell历史记录中(除非您以其他方式阻止它)并且可能包含您的秘密。
$ echo -e "$ACCESS_KEY_ID\n$ACCESS_KEY_SECRET\n" | gsutil config -a
This command will configure HMAC credentials, but gsutil will use
OAuth2 credentials from the Cloud SDK by default. To make sure the
HMAC credentials are used, run: "gcloud config set
pass_credentials_to_gsutil false".
This command will create a boto config file at /Users/tuxdude/.boto
containing your credentials, based on your responses to the following
questions.
Boto config file "/Users/tuxdude/.boto" created. If you need to use a
proxy to access the Internet please see the instructions in that file.
What is your google access key ID? What is your google secret access key?