# GCP GCR

### Use Edgegap with Google Container Registry

### You need to have on hand

* [x] The GCP Region of your GCR
* [x] Your GCP Project Name
* [x] Your JSON Key for the IAM User

### To get this information, go to GCP Console

1. Go to your Project
2. Go to Container Registry
3. Copy the Full Repository Name

### Split the Full Repository Name

Given this Full Repository: **gcr.io/project-name/example**

Your **Repository** will be: **gcr.io**

and your **Image** will be: **project-name/example**

### Generate your JSON Key File

Follow [**GCP Steps**](https://cloud.google.com/container-registry/docs/advanced-authentication#json-key) to generate this file.

{% hint style="warning" %}
Please Verify that your `Google Service Account` has the right permissions to manage your container registry
{% endhint %}

You will end with a file that contains something similar

```json
{
  "type": "service_account",
  "project_id": "project-name",
  "private_key_id": "12345abcdef12345",
  "private_key": "-----BEGIN PRIVATE KEY-----\n[...]\n-----END PRIVATE KEY-----\n",
  "client_email": "example@project-name.iam.gserviceaccount.com",
  "client_id": "1234567890",
  "auth_uri": "https://accounts.google.com/o/oauth2/auth",
  "token_uri": "https://oauth2.googleapis.com/token",
  "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
  "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/example%40project-name.iam.gserviceaccount.com"
}
```

### Add the app on Edgegap

#### **API Example**

{% hint style="info" %}
The username will always be **\_json\_key**
{% endhint %}

```json
{
    [...]
    "docker_repository": "gcr.io",
    "docker_image": "project-name/repository-name",
    "docker_tag": "v1",
    "private_username": "_json_key",
    "private_token": "<The Content of JSON key file as JSON String>",
    [...]
}
```

The Private Token will look something like this

```json
{
    [...]
    "private_token": "{\"type\": \"service_account\", \"project_id\": \"project-name\", \"private_key_id\": \"12345abcdef12345\", \"private_key\": \"-----BEGIN PRIVATE KEY-----\\n[...]\\n-----END PRIVATE KEY-----\\n\", \"client_email\": \"example@project-name.iam.gserviceaccount.com\", \"client_id\": \"1234567890\", \"auth_uri\": \"https://accounts.google.com/o/oauth2/auth\", \"token_uri\": \"https://oauth2.googleapis.com/token\", \"auth_provider_x509_cert_url\": \"https://www.googleapis.com/oauth2/v1/certs\", \"client_x509_cert_url\": \"https://www.googleapis.com/robot/v1/metadata/x509/example%40project-name.iam.gserviceaccount.com\"}",
    [...]
}
```

#### **From Dashboard**

From our Dashboard, The **Private registry token** will be the content of your **JSON key file**

**You can copy the content directly without Stringify it**

<figure><img src="https://3027732442-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR0dHSFv9ymoC0DO5G8J%2Fuploads%2Fgit-blob-7302363fb151d9cdc2e8f010c04158138c9379f0%2Fgcr-example.png?alt=media" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.edgegap.com/docs/tools-and-integrations/container/external-registries/gcp-gcr.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
