# GCP GCR

### Используйте Edgegap с Google Container Registry

### Вам потребуется

* [x] Регион GCP вашего GCR
* [x] Название вашего проекта GCP
* [x] Ваш JSON-ключ для пользователя IAM

### Чтобы получить эту информацию, перейдите в консоль GCP

1. Перейдите в ваш проект
2. Перейдите в Container Registry
3. Скопируйте полное имя репозитория

### Разделить полное имя репозитория

Учитывая этот полный репозиторий: **gcr.io/project-name/example**

Ваш **Репозиторий** будет: **gcr.io**

и ваш **Образ** будет: **project-name/example**

### Сгенерируйте файл JSON-ключа

Следуйте [**Шагам GCP**](https://cloud.google.com/container-registry/docs/advanced-authentication#json-key) чтобы сгенерировать этот файл.

{% hint style="warning" %}
Пожалуйста, убедитесь, что ваш `Сервисный аккаунт Google` имеет необходимые разрешения для управления вашим реестром контейнеров
{% endhint %}

В итоге у вас будет файл, содержащий нечто подобное

```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"
}
```

### Добавьте приложение на Edgegap

#### **Пример API**

{% hint style="info" %}
Имя пользователя всегда будет **\_json\_key**
{% endhint %}

```json
{
    [...]
    "docker_repository": "gcr.io",
    "docker_image": "project-name/repository-name",
    "docker_tag": "v1",
    "private_username": "_json_key",
    "private_token": "<Содержимое файла JSON-ключа в виде JSON-строки>",
    [...]
}
```

Приватный токен будет выглядеть примерно так

```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\"}",
    [...]
}
```

#### **Из панели управления**

На нашей панели управления **Токен приватного реестра** будет содержимым вашего **Файл JSON-ключа**

**Вы можете скопировать содержимое напрямую, не приводя его к строке**

<figure><img src="/files/26ae2326eb26c10f83d618eb6095091c20dea55b" 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/ru/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.
