我正在尝试构建一个简单的应用容器,但收到 403 错误,提示该项目未与结算帐户关联。我已确认该项目已链接到活跃结算帐户,甚至使用以下命令重新尝试gcloud beta
:
gcloud beta billing projects link my-project-foo-bar --billing-account=0A0000-F00000-500000
billingAccountName: billingAccounts/0A0000-F00000-500000
billingEnabled: true
name: projects/my-project-foo-bar/billingInfo
projectId: my-project-foo-bar
gcloud builds submit --tag gcr.io/my-project-foo-bar/test-vd
ERROR: (gcloud.builds.submit) HTTPError 403: The project to be billed is associated with an absent billing account.
使用调试编辑
DEBUG: Running [gcloud.builds.submit] with arguments: [--tag: "gcr.io/my-project-foo-bar/test-vd", --verbosity: "debug"]
DEBUG: (gcloud.builds.submit) HTTPError 403: The project to be billed is associated with an absent billing account.
Traceback (most recent call last):
File "/Users/michaelmoore/google-cloud-sdk/lib/googlecloudsdk/calliope/cli.py", line 981, in Execute
resources = calliope_command.Run(cli=self, args=args)
File "/Users/michaelmoore/google-cloud-sdk/lib/googlecloudsdk/calliope/backend.py", line 807, in Run
resources = command_instance.Run(args)
File "/Users/michaelmoore/google-cloud-sdk/lib/surface/builds/submit.py", line 352, in Run
gcs_client.CreateBucketIfNotExists(gcs_source_staging_dir.bucket)
File "/Users/michaelmoore/google-cloud-sdk/lib/googlecloudsdk/api_lib/storage/storage_api.py", line 342, in CreateBucketIfNotExists
location=location,
File "/Users/michaelmoore/google-cloud-sdk/lib/googlecloudsdk/third_party/apis/storage/v1/storage_v1_client.py", line 314, in Insert
config, request, global_params=global_params)
File "/Users/michaelmoore/google-cloud-sdk/lib/third_party/apitools/base/py/base_api.py", line 731, in _RunMethod
return self.ProcessHttpResponse(method_config, http_response, request)
File "/Users/michaelmoore/google-cloud-sdk/lib/third_party/apitools/base/py/base_api.py", line 737, in ProcessHttpResponse
self.__ProcessHttpResponse(method_config, http_response, request))
File "/Users/michaelmoore/google-cloud-sdk/lib/third_party/apitools/base/py/base_api.py", line 604, in __ProcessHttpResponse
http_response, method_config=method_config, request=request)
HttpForbiddenError: HttpError accessing <https://www.googleapis.com/storage/v1/b?project=api-test&alt=json>: response: <{'status': '403', 'content-length': '357', 'vary': 'Origin, X-Origin', 'server': 'UploadServer', 'x-guploader-uploadid': 'AEnB2Uqi4TwPvMI-tf1aL37obYGUVsoEjKE-kbRfUVE46-VxmflbIHNkt_lJOnFr30GSMHfS6ojxcJf_c7SCfNpdSRlcVMsh2Q', 'date': 'Mon, 27 Jan 2020 15:35:13 GMT', 'alt-svc': 'quic=":443"; ma=2592000; v="46,43",h3-Q050=":443"; ma=2592000,h3-Q049=":443"; ma=2592000,h3-Q048=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000', 'content-type': 'application/json; charset=UTF-8'}>, content <{
"error": {
"errors": [
{
"domain": "global",
"reason": "accountDisabled",
"message": "The project to be billed is associated with an absent billing account.",
"locationType": "header",
"location": "Authorization"
}
],
"code": 403,
"message": "The project to be billed is associated with an absent billing account."
}
}
有什么想法吗?
答案1
您可以查看“Google Cloud Platform”,他们有一些关于构建 Google 容器的有用资源,您可以在 Youtube 上找到它们。他们有一个 YouTube 频道。
答案2
为了安全起见,请检查这文档以确保您的帐单帐户设置正确,然后按照 Emil 的建议,验证 API 是否已启用并且您的帐户具有执行操作的适当 IAM 权限,然后重试。403 和错误消息通常是 2 件事:
- 该帐户没有附加真实的帐单帐户,您需要执行该任务。
- 未启用 API 和/或未设置执行操作所需的权限。
无论如何,如果这似乎不起作用,只需在线程中写下您的输出,Emil、我自己或任何其他贡献者都可以帮助您摆脱该错误。
祝你有美好的一天!