In this section, we would push the container created in earlier step to Google Container Registry. Google Container Registry provides secure private registry and access controls for your docker containers.
Follow the steps below –
- Tag the image.
> sudo docker tag kube-e2e-solution gcr.io/navveen-api/kube-e2e-solution:v1
This assumes that we would be deploying the container to the gcr.io region. Replace navveen-api by our project name. For deploying to other regions, please refer to https://cloud.google.com/container-registry/docs/pushing-and-pulling.
- Create a short lived Access Token to push to container registry (For more details, kindly refer to – https://cloud.google.com/container-registry/docs/advanced-authentication).
> sudo gcloud auth print-access-token | sudo docker login -u oauth2accesstoken –password-stdin https://gcr.io
Figure 15 – Output of access login token command
- Push the image to your project (in this case below, navveen-api is the project name).
> sudo docker push gcr.io/navveen-api/kube-e2e-solution:v1
You should see the digest being printed as shown below.
Figure 16 – Output of Docker push command