13.3.2.5. 修改 Google Cloud Platform 对象存储桶
注意
目前,IBM Power 和 IBM Z 不支持修改 Google Cloud Platform 对象存储桶。
使用以下步骤为虚拟构建器配置跨原始资源共享(CORS)。
注意
如果没有 CORS 配置,上传构建 Dockerfile 会失败。
步骤
使用以下引用来创建 JSON 文件,以满足您的特定 CORS 需求。例如:
$ cat gcp_cors.json输出示例
[ { "origin": ["*"], "method": ["GET"], "responseHeader": ["Authorization"], "maxAgeSeconds": 3600 }, { "origin": ["*"], "method": ["PUT"], "responseHeader": [ "Content-Type", "x-goog-acl", "origin"], "maxAgeSeconds": 3600 } ]输入以下命令更新 GCP 存储桶:
$ gcloud storage buckets update gs://<bucket_name> --cors-file=./gcp_cors.json输出示例
Updating Completed 1您可以运行以下命令来显示 GCP 存储桶的更新 CORS 配置:
$ gcloud storage buckets describe gs://<bucket_name> --format="default(cors)"输出示例
cors: - maxAgeSeconds: 3600 method: - GET origin: - '*' responseHeader: - Authorization - maxAgeSeconds: 3600 method: - PUT origin: - '*' responseHeader: - Content-Type - x-goog-acl - origin