Google Cloud Registry too long not read

1. Install Google SDK on your computer Ref. https://cloud.google.com/sdk/docs/install

2. Login google account and gcloud project with command below

gcloud auth login

gcloud auth configure-docker
  • Incase , you use docker-compose file or use CI/CD pipeline , we recommend use service account with json key file to authen with google cloud

Create service account with google cloud storage role (read, write,admin)
Example login with JSON key

cat keyfile.json | docker login -u _json_key --password-stdin https://HOSTNAME
where HOSTNAME is gcr.io, us.gcr.io, eu.gcr.io, or asia.gcr.io.
cat box-in-the-box-7ab21e41seb57.json|  docker login -u _json_key --password-stdin https://asia.gcr.io

3. Build image by use image path details as below

[HOSTNAME]/[PROJECT-ID]/[IMAGE]

Example
asia.gcr.io/box-in-the-box/core-social

4. Docker build , tag, push , pull

docker build -t asia.gcr.io/box-in-the-box/social:latest .
docker push asia.gcr.io/box-in-the-box/social:latest 
docker pull asia.gcr.io/box-in-the-box/social:latest 

5. Docker Compose example

version: '3'

services:
  box_core-social:
    container_name: social
    environment:
      - "NODE_ENV=${NODE_ENV}"
    #build:
    #  context: .
    #  dockerfile: Dockerfile-live
    image: asia.gcr.io/box-in-the-box/social
    ports:
      - "2000:3000"
    volumes:
      - "/opt/app/"
    restart: on-failure:5

Leave a Reply

Your email address will not be published. Required fields are marked *