This page looks best with JavaScript enabled

How to use oras CLI tool for GCR

· ☕ 1 min read
🏷️
  • #books
  • Hi, I was trying to use deislabs/oras, CLI tool and Go packages to operate OCI images with Google Container Registry(GCR), I stumbled and it took me a long time to get there.

    In this post, I will explain how to configure oras for GCR. This is just a memo for myself.

    Before you start

    First, install deislabs/oras by following the instructions on the README.

    In this post, I’m using this version.

    $ oras version
    Version:        0.8.1
    Go version:     go1.12.4
    Git commit:     237ac925cb6a308a5523cc048292bb53037f6975
    Git tree state: clean
    

    If you don’t have an GCP account, you should create one.

    1. Login by oras

    REGISTRY="gcr.io"
    PROJECT="my-project"
    
    gcloud auth print-access-token \
    | oras login -u oauth2accesstoken --password-stdin https://${REGISTRY}
    

    2. Push OCI image

    oras push gcr.io/${PROJECT}/hello-artifact:v1 ./artifact.txt
    

    Still, the image that you pushed doesn’t have any root filesystem.
    Therefore, you can’t docker pull and you have to use oras to pull images.

    References

    Share on

    Keisuke Yamashita
    WRITTEN BY
    Keisuke Yamashita
    Site Reliability Engineer