如何使用GitLab ci管道将docker映像推送到Google云注册表

如何使用GitLab ci管道将docker映像推送到Google云注册表,docker,google-cloud-platform,gitlab,Docker,Google Cloud Platform,Gitlab,我试图通过GitLab ci管道将Docker映像推送到Google云注册表 图像生成,但当它的时间推到注册表我得到以下错误 拒绝:项目“nice-column-247216”的令牌交换失败。呼叫者 没有“storage.bucket.get”权限。配置 权限,请按照以下地址的说明操作: .gitlab ci.yml stages: - security - quality - test - build - deploy image: node:10.16.0 serv

我试图通过GitLab ci管道将Docker映像推送到Google云注册表

图像生成,但当它的时间推到注册表我得到以下错误

拒绝:项目“nice-column-247216”的令牌交换失败。呼叫者 没有“storage.bucket.get”权限。配置 权限,请按照以下地址的说明操作:

.gitlab ci.yml

stages:
  - security
  - quality
  - test
  - build
  - deploy

image: node:10.16.0

services:
  - mongo
  - docker:dind

.before_script_template: &before_docker_script
  before_script:
    - apt-get update
    - apt-get -y install apt-transport-https ca-certificates curl gnupg2 software-properties-common
    - curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add -
    - add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable"
    - apt-get update
    - apt-get -y install docker-ce
    - curl -L "https://github.com/docker/compose/releases/download/1.23.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
    - chmod +x /usr/local/bin/docker-compose
    - echo "$SERVICE_ACCOUNT_KEY" > key.json
    - docker login -u _json_key --password-stdin https://eu.gcr.io < key.json

build:
  stage: build
  <<: *before_docker_script
  variables:
    DOCKER_IMAGE_TAG: 'eu.gcr.io/nice-column-247216/my-application'
  script:
    - docker build --cache-from "${DOCKER_IMAGE_TAG}" -t "${DOCKER_IMAGE_TAG}" .
    - docker push ${DOCKER_IMAGE_TAG}
阶段:
-保安
-品质
-试验
-建造
-部署
图像:节点:10.16.0
服务:
-蒙戈
-码头工人:丁
.before\u脚本\u模板:&before\u docker\u脚本
在脚本之前:
-apt获取更新
-apt get-y安装apt传输https ca证书gnupg2软件属性通用
-curl-fsSLhttps://download.docker.com/linux/debian/gpg |apt密钥添加-
-添加apt存储库“deb[arch=amd64]https://download.docker.com/linux/debian $(lsb_发布-cs)稳定“
-apt获取更新
-apt get-y安装docker ce
-卷曲-L“https://github.com/docker/compose/releases/download/1.23.2/docker-compose-$(uname-s)-(uname-m)“-o/usr/local/bin/docker组合
-chmod+x/usr/local/bin/docker组合
-echo“$SERVICE\u ACCOUNT\u KEY”>KEY.json
-docker登录-u\u json\u密钥——密码标准https://eu.gcr.io 你确定docker登录正常吗?您是否尝试使用损坏的密钥?