我正在尝试在不使用 gcloud 界面的情况下将 Google Container Registry 与 GitLab CI 一起使用。
使用“使用 JSON 密钥文件”部分下列出的文档: https ://cloud.google.com/container-registry/docs/advanced-authentication
我已将我的服务帐户凭据文件下载为 JSON 文件:
{
"type": "service_account",
"project_id": "REDACTED",
"private_key_id": "REDACTED",
"private_key": "-----BEGIN PRIVATE KEY-----\nBIGLONGLISTOFGARBLEDTEXTNSTUFF\n-----END PRIVATE KEY-----\n",
"client_email": "somethingsomething@developer.gserviceaccount.com",
"client_id": "NUMBERSNUMBERSNUMBERS",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://accounts.google.com/o/oauth2/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/somethingsomething%40developer.gserviceaccount.com"
}
然后我尝试使用指定的命令登录:
docker login -u _json_key -p "$(cat google_cred.json)" https://gcr.io
这会产生以下错误:
Cannot connect to the Docker daemon. Is the docker daemon running on this host?
docker login https://gcr.io
为我提供了用户名/密码交互式提示,因此据我所知,我的本地 docker 安装不是问题。
有什么我想念的吗?