建置 Google 容器

建置 Google 容器

我正在嘗試建立一個簡單的應用程式容器,但收到 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 和錯誤訊息通常有兩件事:

  • 該帳戶沒有附加真實的計費帳戶,您需要執行該任務。
  • 未啟用 API 和/或未設定執行操作所需的權限。

無論如何,如果這似乎不起作用,只需將您的輸出寫入線程中,Emil、我自己或任何其他貢獻者都可以幫助您擺脫該錯誤。

祝你有美好的一天!

相關內容