Google cloud CLI cheatsheet
Basic google cloud CLI commands
# list images
gcloud compute images list
# list images uri's
gcloud compute images list --uri# autocompletion is available
gcloud compute instances start "$instance"
gcloud compute instances stop "$instance"
gcloud compute instances delete "$instance"gcloud compute addresses list --filter="name=$instance"# it has to be current project's region
gcloud config get-value compute/regiongcloud artifacts locations list# DO NOT EXPOSE THE SERVICE ACCOUNT KEY
cat /path/to/gcloud.service.account.key.json | docker login -u _json_key --password-stdin "https://$region-docker.pkg.dev"# tag image for push to private gcloud registry
docker tag "$image:$tag" "$region-docker.pkg.dev/$project_id/$registry_name/$image:$tag"
# push image to the registry
docker push "$region-docker.pkg.dev/$project_id/$registry_name/$image:$tag"
# pull image (docker daemon has to be authenticated)
docker pull "$region-docker.pkg.dev/$project_id/$registry_name/$image:$tag"