[Yandex Cloud documentation](../../../index.md) > [Yandex Container Registry](../../index.md) > [Step-by-step guides](../index.md) > Managing a repository > Creating a repository

# Creating a repository

{% note info %}

A [repository](../../concepts/repository.md) will only be displayed after you [push](../docker-image/docker-image-push.md) a [Docker image](../../concepts/docker-image.md) to it.

{% endnote %}

To create a repository:

{% list tabs group=instructions %}

- Terraform {#tf}

  With [Terraform](https://www.terraform.io/), you can quickly create a cloud infrastructure in Yandex Cloud and manage it using configuration files. These files store the infrastructure description written in HashiCorp Configuration Language (HCL). If you change the configuration files, Terraform automatically detects which part of your configuration is already deployed, and what should be added or removed.
  
  Terraform is distributed under the [Business Source License](https://github.com/hashicorp/terraform/blob/main/LICENSE). The [Yandex Cloud provider for Terraform](https://github.com/yandex-cloud/terraform-provider-yandex) is distributed under the [MPL-2.0](https://www.mozilla.org/en-US/MPL/2.0/) license.
  
  For more information about the provider resources, see the guides on the [Terraform](https://www.terraform.io/docs/providers/yandex/index.html) website or [its mirror](../../../terraform/index.md).

  If you do not have Terraform yet, [install it and configure the Yandex Cloud provider](../../../tutorials/infrastructure-management/terraform-quickstart.md#install-terraform).
  
  
  To manage infrastructure using Terraform under a service account or user accounts (a Yandex account, a federated account, or a local user), [authenticate](../../../terraform/authentication.md) using the appropriate method.

  1. Specify the `yandex_container_repository` properties in the configuration file:

     ```hcl
     resource "yandex_container_registry" "my-registry" {
       name = "test-registry"
     }

     resource "yandex_container_repository" "my-repository" {
       name = "${yandex_container_registry.my-registry.id}/<repository_name>"
     }

     output "my-registry-id" {
       value = yandex_container_registry.my-registry.id
     }

     output "my-repository-name" {
       value = yandex_container_repository.my-repository.name
     }
     ```

     Where `--repository-name` is the repository name in `<registry_ID>/<repository_name>` format. You can retrieve [registry](../../concepts/registry.md) ID from the [folder registry list](../registry/registry-list.md#registry-list).

     For more on the properties of the `yandex_container_repository` resource, see [this provider guide](../../../terraform/resources/container_repository.md).
  1. Create the resources:

     1. In the terminal, navigate to the configuration file directory.
     1. Make sure the configuration is correct using this command:
     
        ```bash
        terraform validate
        ```
     
        If the configuration is valid, you will get this message:
     
        ```bash
        Success! The configuration is valid.
        ```
     
     1. Run this command:
     
        ```bash
        terraform plan
        ```
     
        You will see a list of resources and their properties. No changes will be made at this step. Terraform will show any errors in the configuration.
     1. Apply the configuration changes:
     
        ```bash
        terraform apply
        ```
     
     1. Type `yes` and press **Enter** to confirm the changes.

     Terraform will create all the required resources. You can check the new resources in the [management console](https://console.yandex.cloud) or using this [CLI](../../../cli/index.md) command:

     ```bash
     yc container repository list --registry-id <registry_ID>
     ```

- API {#api}

  To create a repository, use the [upsert](../../api-ref/Repository/upsert.md) REST API method for the [Repository](../../api-ref/Repository/index.md) resource or the [RepositoryService/Upsert](../../api-ref/grpc/Repository/upsert.md) gRPC API call.

{% endlist %}