はじめに
GCP Container RegistryにDocker Imageをpushする方法の備忘録です。
手順
$ gcloud config list
[core] account = hogehoge@example.com disable_usage_reporting = False project = hogehoge
$ gcloud auth configure-docker
The following settings will be added to your Docker config file
located at [/Users/user/.docker/config.json]: { "credHelpers": { "gcr.io": "gcloud", "us.gcr.io": "gcloud", "eu.gcr.io": "gcloud", "asia.gcr.io": "gcloud", "staging-k8s.gcr.io": "gcloud", "marketplace.gcr.io": "gcloud" } }
Do you want to continue (Y/n)?
→yes
$ docker build -f ~/Dockerfile -t [image name] .
Successfully built ●●●● Successfully tagged ●●●●:latest
$ docker images
→buildしたimageを確認できる。
$ docker tag [image name] gcr.io/~/[image name]:latest
$ gcloud docker -- push gcr.io/~/[image name]
8bac3adefc84: Pushed 9317358e9e38: Pushed
→成功です。