dockergoogle-cloud-platformgoogle-container-registry

Docker unable to login using _json_key_base64, but can login with _json_key


I saved the json key file to a local file jsonkey, then login to GCR using it. Following this guide, I should be able to login using either json key or base64 encoded json key.

However _json_key_base64 doesn't work, only _json_key works.

Here's my command:

$ cat jsonkey | base64 | docker login -u _json_key_base64 --password-stdin \
https://asia.gcr.io
Error response from daemon: Get "https://asia.gcr.io/v2/": unauthorized: Not Authorized.

$ cat jsonkey | docker login -u _json_key --password-stdin \ 
https://asia.gcr.io
Login Succeeded

Anyone knows why?


Solution

  • A bug was raised to GCP team, this feature is not supported in Container Registry.

    It is not possible for users to login to Container Registry through a _json_key_base_64 as Container Registry does not support this type of key. If you need this functionality, please consider migrating to Artifact Registry which does support it.

    They also edited the related documentation, _json_key_base64 is not listed as supported anymore, only _json_key.