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

# Creating a registry

The new [registry](../../../resource-manager/concepts/resources-hierarchy.md#folder) can be used by all users and [service accounts](../../concepts/registry.md) with access permissions for the [folder](../../../iam/concepts/users/service-accounts.md). 

You can create a secure registry with autoscanning using a [vulnerability scanner](../../concepts/vulnerability-scanner.md).

{% note info %}

Scanning Docker images for vulnerabilities is [charged](../../pricing.md#scanner).

{% endnote %}

{% list tabs group=instructions %}

- Management console {#console}

  1. In the [management console](https://console.yandex.cloud), select the folder where you want to create a registry.
  1. Navigate to **Container Registry**.
  1. Click **Create registry**.
  1. Specify a name for the registry. The naming requirements are as follows:
  
      * Length: between 3 and 63 characters.
      * It can only contain lowercase Latin letters, numbers, and hyphens.
      * It must start with a letter and cannot end with a hyphen.
  
  1. Optionally, under **Automatic scanning**:
  
  
      * Disable **Scan Docker images on push** to skip scanning of Docker images at their upload to the repository.
      * Disable **Scan all Docker images in the registry** or set the scanning frequency.
  
        {% note warning %}
        
        Automatic Docker image scanning makes your registry more secure. The default vulnerability scan settings are consistent with the [Yandex Cloud cloud infrastructure security standard](../../../security/standard/app-security.md#pipeline-recommendations).
        
        {% endnote %}
  
  1. Optionally, add labels.
  1. Click **Create registry**.

- CLI {#cli}

  If you do not have the Yandex Cloud CLI yet, [install and initialize it](../../../cli/quickstart.md#install).
  
  The folder used by default is the one specified when [creating](../../../cli/operations/profile/profile-create.md) the CLI profile. To change the default folder, use the `yc config set folder-id <folder_ID>` command. You can also specify a different folder for any command using `--folder-name` or `--folder-id`. If you access a resource by its name, the search will be limited to the default folder. If you access a resource by its ID, the search will be global, i.e., through all folders based on access permissions.
  
  1. Make sure that a registry has not been created in the folder yet:
  
      ```bash
      yc container registry list
      ```
  
      Result:
  
      ```text
      +----+------+-----------+
      | ID | NAME | FOLDER ID |
      +----+------+-----------+
      +----+------+-----------+
      ```
  
      If the folder already contains a registry, see [Updating a registry](registry-update.md) for info on how you can update it.
  
  1. Create a registry:
  
      * With automated vulnerability scanning:
  
  
          ```bash
          yc container registry create --name my-reg --secure
          ```
  
        {% note warning %}
        
        Automatic Docker image scanning makes your registry more secure. The default vulnerability scan settings are consistent with the [Yandex Cloud cloud infrastructure security standard](../../../security/standard/app-security.md#pipeline-recommendations).
        
        {% endnote %}
  
      * Without automated vulnerability scanning:
  
          ```bash
          yc container registry create --name my-reg
          ```
  
      Result:
  
      ```text
      done
      id: crpd50616s9a********
      folder_id: b1g88tflru0e********
      name: my-reg
      status: ACTIVE
      created_at: "2019-01-09T14:34:06.601Z"
      ```
  
      Follow these registry naming requirements:
  
      * Length: between 3 and 63 characters.
      * It can only contain lowercase Latin letters, numbers, and hyphens.
      * It must start with a letter and cannot end with a hyphen.
  
      The `--name` parameter is optional. You can create a registry without a name and use its ID to access it. The `name` field is user-defined. It is used when listing in the Yandex Cloud CLI and not used in the Docker CLI.
  1. Make sure the registry was created:
  
      ```bash
      yc container registry list
      ```
  
      Result:
  
      ```text
      +----------------------+--------+----------------------+
      |          ID          |  NAME  |      FOLDER ID       |
      +----------------------+--------+----------------------+
      | crpd50616s9a******** | my-reg | b1g88tflru0e******** |
      +----------------------+--------+----------------------+
      ```

- Terraform {#tf}

  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. Include the parameters of the registry you want to create in the configuration file, e.g., a file named `example.tf` in the `~/cloud-terraform` directory:

     ```hcl
     resource "yandex_container_registry" "my-reg" {
       name = "my-registry"
       folder_id = "<folder_ID>"
       labels = {
         my-label = "my-label-value"
       }
     }
     ```

     Where:
     * `name`: Registry name.
     * `folder_id`: Folder ID.
     * `labels`: [Labels](../../../resource-manager/concepts/labels.md) used.

     For more information about resources you can create with Terraform, see [this provider reference](../../../terraform/index.md).
  1. Make sure the configuration file is correct.
     1. Use the command line to go to the directory where you saved the configuration file:

        ```bash
        cd /Users/<username>/cloud-terraform
        ```

     1. Run a check using this command:

        ```bash
        terraform plan
        ```

        Result:

        ```text
        Refreshing Terraform state in-memory prior to plan...
        The refreshed state will be used to calculate this plan, but will not be
        persisted to local or remote state storage.
        ...
        Note: You did not specify an "-out" parameter to save this plan, so Terraform
        cannot guarantee that exactly these actions will be performed if
        "terraform apply" is subsequently run.
        ```

  1. Create a registry.
     1. Run this command:

        ```bash
        terraform apply
        ```

        Result:

        ```text
        An execution plan has been generated and is shown below.
        Resource actions are indicated with the following symbols:
          + create
        ...
          Terraform will perform the actions described above.
          Only 'yes' will be accepted to approve.

          Enter a value:
        ```

     1. Confirm creation of the registry. To do this, type `yes` and press **Enter**:

        ```bash
        Enter a value: yes
        ```

        Result:

        ```text
        yandex_container_registry.default: Creating...
        yandex_container_registry.default: Creation complete after 4s [id=crpuljdfqoj3********]

        Apply complete! Resources: 1 added, 0 changed, 0 destroyed.
        ```

        This will create a registry named `my-registry` in the folder.
     1. Check the resources and their settings in the [management console](https://console.yandex.cloud).

- API {#api}

  To create a registry, use the [create](../../api-ref/Registry/create.md) method for the [Registry](../../api-ref/Registry/index.md) resource.

{% endlist %}