• Create an account to access the Registry
export PROJECT=my-project
export KEY_NAME=key-name
export KEY_DISPLAY_NAME="My Key Name"
  • Create and get the key
gcloud iam service-accounts create ${KEY_NAME} —-display-name ${KEY_DISPLAY_NAME}
gcloud iam service-accounts list
gcloud iam service-accounts keys create — iam-account ${KEY_NAME}@${PROJECT}.iam.gserviceaccount.com key.json
  • Provide it with the appropriate rights
gcloud projects add-iam-policy-binding ${PROJECT} —-member serviceAccount:${KEY_NAME}@${PROJECT}.iam.gserviceaccount.com —-role roles/storage.admin
  • Use the credentials to access the registry
$ docker login -u 帳號 -p "$(cat keyfile.json)" https://gcr.io
  • Push your image
docker push gcr.io/${PROJECT}/example-image

results matching ""

    No results matching ""