Docker计算机不能与Google云服务帐户一起使用

Docker计算机不能与Google云服务帐户一起使用,docker,docker-machine,google-compute-engine,Docker,Docker Machine,Google Compute Engine,我使用服务帐户创建了一个google compute实例 gcloud --project my-proj compute instances create test1 \ --image-family "debian-9" --image-project "debian-cloud" \ --machine-type "g1-small" --network "default" --maintenance-policy "MIGRATE" \ --service-account "gke-bu

我使用服务帐户创建了一个google compute实例

gcloud --project my-proj compute instances create test1 \
--image-family "debian-9" --image-project "debian-cloud" \
--machine-type "g1-small" --network "default" --maintenance-policy "MIGRATE" \
--service-account "gke-build-robot@myproj-184015.iam.gserviceaccount.com" \
--scopes "https://www.googleapis.com/auth/cloud-platform" \
--tags "gitlab-runner" \
--boot-disk-size "10" --boot-disk-type "pd-standard" --boot-disk-device-name "$RESOURCE_NAME" \
--metadata register_token=mytoken,config_bucket=gitlab_config,runner_name=test1,gitlab_uri=myuri,runner_tags=backend \
--metadata-from-file "startup-script=startup-scripts/prepare-runner.sh"
通过ssh登录到实例:
gcloud compute--project“myproj”ssh--zone“europe-west1-b”“gitlab共享运行程序池”

安装和配置docker机器后。我尝试创建实例:

     docker-machine create --driver google --google-project myproj test2
    Running pre-create checks...
    (test2) Check that the project exists
    (test2) Check if the instance already exists
    Creating machine...
    (test2) Generating SSH Key
    (test2) Creating host...
    (test2) Opening firewall ports
    (test2) Creating instance
    (test2) Waiting for Instance
Error creating machine: Error in driver during machine creation: Operation error: {EXTERNAL_RESOURCE_NOT_FOUND  The resource '1045904521672-compute@developer.gserviceaccount.com' of type 'serviceAccount' was not found. []}
1045904521672-compute@developer.gserviceaccount.com是我的默认帐户。 我不知道;我不明白为什么要用它。因为激活的是gke构建-robot@myproj-184015.iam.gserviceaccount.com

gcloud config list
[core]
account = gke-build-robot@myproj-184015.iam.gserviceaccount.com
disable_usage_reporting = True
project = novaposhta-184015
Your active configuration is: [default]

 gcloud auth list
                      Credentialed Accounts
ACTIVE  ACCOUNT
*       gke-build-robot@myproj-184015.iam.gserviceaccount.com
有人能解释一下我做错了什么吗?

一个类似的问题()在某种程度上暗示了

此错误消息不清楚,特别是因为也需要在清单中指定的凭据可能与另一个帐户完全关联

如果bosh清单未主动设置,
bosh google cpi版本的默认
服务\u帐户
将设置为“
默认
”,因此这将在您使用
服务范围
而不是
服务\u帐户
时发生

虽然你没有使用谷歌cpi发布版,但最后一句话让我仔细检查了一下

服务帐户是附加到实例的标识。其访问令牌可通过实例元数据服务器访问,并用于验证实例上的应用程序。
该帐户可以是电子邮件地址,也可以是与服务帐户对应的别名。您可以使用“
default
”别名显式指定计算引擎默认服务帐户

如果未提供,则实例将获得project的默认服务帐户

这就好像您的服务帐户被忽略或不正确(并返回到项目默认帐户)

请参阅“”以再次检查其值:

通常,服务帐户的电子邮件来自服务帐户ID,格式如下:


或者试试。

有双重问题

  • 首先,docker机器无法使用特定的服务帐户,至少在0.12和0.13版本中是这样
  • Docker+机器google驱动程序只有
    范围
    参数,无法获取具体参数。
    因此,安装docker+机器的实例可以使用指定的
    sa
    正常工作但使用docker+机器创建的实例必须具有默认服务帐户
    在调试期间,我会将其关闭。
    结果我犯了这个错误

我使用0.12版本的docker机器。0.13版本不工作,始终返回分段失败。我看到$GOOGLE\u应用程序\u凭据为空。我不明白,在哪里可以找到gcloud凭证存储的完整脚本这个服务帐户工作正常。由于公司政策的原因,我更改了它的名称。我不想为我的默认服务帐户创建别名。我想用docker机器和特定的一个。错误消息只显示docker+机器使用的不是指定的帐户,而是默认帐户。我关掉它一段时间。因为我注意到它是就地使用的,我希望使用特定帐户,而不是默认帐户。我不需要将服务帐户设置为实例。gcloud计算实例描述gitlab共享运行程序池->服务帐户:-电子邮件:gke build-robot@myproj-184015.iam.gserviceaccount.com作用域:-gce prospect的每件事都很好,但某些原因是docker+机器想要使用默认服务帐户。@user2870704是的,这确实是个问题。我认为明确地强制使用服务帐户会改善这种情况。这是没有帮助的。如何使用“default”别名显式指定计算引擎默认服务帐户。我需要创建sa,名称中带有
默认值
?确定我的UI不工作。但我是gcloud ctl的可重入API。这对我有帮助。
[SERVICE-ACCOUNT-NAME]@[PROJECT_ID].iam.gserviceaccount.com