How do I add private Google Container Registry images in my application?


#1

GCR doesn’t support basic authentication like other registries that conform to the Docker registry spec? How can I add credentials to the Vendor Portal for GCR?


How do I configure gcr.io external registry?
#2

Replicated allows for integration with the Google Container Registry (GCR) through the JSON Key authentication mechanism.

In Google Cloud Platform you must first set up a Service Account with permissions to pull from the GCR repo by giving that account the “Storage Object Viewer” role.

You can then create a JSON key from that Service Account. When prompted for key type, make sure to select “JSON” before creating. After clicking create, a JSON file will be downloaded in your browser. This file will be used in the next step.

Under your application in the Replicated Vendor Portal, you will have the option of adding external registries. Under Username you must specify “_json_key”. Use the contents of the key file, omitting line breaks, in the field Password. Email Address in this case is ignored. Please note that GCR has multiple hostnames which are not interchangeable, so be sure to add the correct one to the Endpoint field.

Once you have added GCR as an external registry you can use the image in the containers section of your yaml like so.


#3

I’ll add for removing whitespace from the JSON Key file, jq is quite handy:

cat ~/downloads/replicated-1321312asa.json | jq -r -c -M . | pbcopy