Pushing and pulling images using google cloud docker service

* Before you start, make sure that you


  • Enabled billing for your project.

  • Enabled the Container Registry API.

  • Installed the most recent version of the Cloud SDK, which includes the gcloud command-line tool
  • Installed Docker. Version 18.03 or newer is required if you want to use the gcloud credential helper for authentication (recommended).To install Docker Engine, you need the 64-bit version of one of these Ubuntu versions:
    • Ubuntu Focal 20.04 (LTS)
    • Ubuntu Eoan 19.10
    • Ubuntu Bionic 18.04 (LTS)
    • Ubuntu Xenial 16.04 (LTS)
           Note: Docker Engine is supported on x86_64 (or amd64), armhf, and arm64 architectures.
  • Login to have permission to push or pull from the  registry.
gcloud auth login
  • Set project Id.
gcloud config set project tomoco
  • Configured Docker to use gcloud as a credential helper
gcloud auth configure-docker

* Pushing an image to a registry

Note: To push a new image to Container Registry, you need to first tag it with the registry name: docker tag [SOURCE_IMAGE] [HOSTNAME]/[PROJECT-ID]/[IMAGE]
docker tag habogay/spring-boot-docker-gcb  us.gcr.io/tomoco/spring-boot-docker-gcb

  • Push image to the container registry: docker push [HOSTNAME]/[PROJECT-ID]/[IMAGE]
docker push us.gcr.io/tomoco/spring-boot-docker-gcb

  • Pull image to the container registry: docker pull [HOSTNAME]/[PROJECT-ID]/[IMAGE]:[TAG]
docker pull us.gcr.io/tomoco/spring-boot-docker-gcb

* DONE :D 

Share this

Related Posts

Latest
Previous
Next Post »