Push to Google Cloud Registry


Auth

gcloud auth login
gcloud auth configure-docker

Pull

# Option 1 - pull from Docker Hub
docker pull [USERNAME]/[IMAGE]:[TAG]

# Option 2 - pull from GCR
docker pull [REPOSITORY_NAME]/[FOLDER]/[IMAGE]:[TAG]

Example

# Option 1 - pull from Docker Hub
docker pull itsmetommy/go-guestbook:latest

# Option 2 - pull from GCR
docker pull us.gcr.io/[PROJECT_ID]/itsmetommy/go-guestbook:latest

Tag

Note: Use folder separation, as it is the preferred method.

docker tag [IMAGE]:[TAG] us.gcr.io/[PROJECT_ID]/[FOLDER]/[IMAGE]:[TAG]

Example

docker tag itsmetommy/go-guestbook:latest us.gcr.io/[PROJECT_ID]/itsmetommy/go-guestbook:latest
docker images | grep go-guestbook
itsmetommy/go-guestbook                          latest    c91f65087b1f   2 months ago   315MB
us.gcr.io/[PROJECT_ID]/itsmetommy/go-guestbook   latest    c91f65087b1f   2 months ago   315MB

Push

  • gcr.io currently hosts the images in the United States, but the location may change in the future
  • us.gcr.io hosts the image in the United States, in a separate storage bucket from images hosted by gcr.io
  • eu.gcr.io hosts the images within member states of the European Union
  • asia.gcr.io hosts the images in Asia
docker push [HOSTNAME]/[PROJECT_ID]/[FOLDER]/[IMAGE]:[TAG]

Example

docker push us.gcr.io/[PROJECT_ID]/itsmetommy/go-guestbook:latest