Yandex.Cloud
  • Services
  • Why Yandex.Cloud
  • Solutions
  • Pricing
  • Documentation
  • Contact us
Get started
Yandex Container Registry
  • Getting started
  • Step-by-step instructions
    • All instructions
    • Authentication in Yandex Container Registry
    • Managing a Docker image
      • Getting information about available Docker images
      • Creating a Docker image
      • Pushing a Docker image to a registry
      • Pulling a Docker image from a registry
      • Deleting a Docker image from a registry
    • Managing a registry
      • Getting information about existing registries
      • Creating a registry
      • Updating a registry
      • Deleting a registry
    • Managing a repository
      • Getting information about existing repositories
    • Managing policies for automatically deleting Docker images
      • Getting information about existing lifecycle policies
      • Creating a lifecycle policy
      • Updating a lifecycle policy
      • Performing lifecycle policy dry runs
      • Deleting a lifecycle policy
    • Working with roles
      • Assign a role
      • Viewing assigned roles
      • Revoke a role
  • Yandex Container Solution
  • Use cases
    • All use cases
    • Running a Docker image on a VM
  • Concepts
    • Overview
    • Docker image
    • Registry
    • Repository
    • Policies for automatically deleting Docker images
    • Backups
    • Quotas and limits
  • Access management
  • Pricing policy
  • API reference
    • Authentication in the API
    • gRPC
      • Overview
      • ImageService
      • LifecyclePolicyService
      • RegistryService
      • RepositoryService
      • ScannerService
      • OperationService
    • REST
      • Overview
      • Image
        • Overview
        • delete
        • get
        • list
      • LifecyclePolicy
        • Overview
      • Registry
        • Overview
        • create
        • delete
        • get
        • list
        • listAccessBindings
        • setAccessBindings
        • update
        • updateAccessBindings
      • Repository
        • Overview
        • get
        • list
        • listAccessBindings
        • setAccessBindings
        • updateAccessBindings
      • Scanner
        • Overview
  • Troubleshooting
  • Questions and answers
  1. Step-by-step instructions
  2. Managing a registry
  3. Creating a registry

Creating a registry

    The created registry can be used by any users and service accounts that have rights for the folder.

    Management console
    CLI
    API
    Terraform
    1. In the management console, select the folder to create a registry in.

    2. In the list of services, select Container Registry.

    3. Specify a name for the registry.

      • Length — from 3 to 63 characters.
      • The name may contain lowercase Latin letters, numbers, and hyphens.
      • The first character must be a letter. The last character can't be a hyphen.
    4. Click Create registry.

    If you don't have the Yandex.Cloud command line interface yet, install and initialize it.

    The folder specified in the CLI profile is used by default. You can specify a different folder using the --folder-name or --folder-id parameter.

    1. Make sure that a registry has not been created in the folder yet:

      yc container registry list
      

      Command execution result:

      +----+------+-----------+
      | ID | NAME | FOLDER ID |
      +----+------+-----------+
      +----+------+-----------+
      

      If the folder already contains a registry, see Updating a registry for information about how you can change it.

    2. Create a registry:

      yc container registry create --name my-reg
      

      Command execution result:

      done
      id: crpd50616s9a2t7gr8mi
      folder_id: b1g88tflru0ek1omtsu0
      name: my-reg
      status: ACTIVE
      created_at: "2019-01-09T14:34:06.601Z"
      
      • Length — from 3 to 63 characters.
      • The name may contain lowercase Latin letters, numbers, and hyphens.
      • The first character must be a letter. The last character can't be a hyphen.
      • The flag --name is optional. You can create a registry without a name and access it by its ID.
      • The name field is user-defined: it is used for listing in the YC CLI and is not used in the Docker CLI.
    3. Make sure the registry was created:

      yc container registry list
      

      Command execution result:

      +----------------------+--------+----------------------+
      |          ID          |  NAME  |      FOLDER ID       |
      +----------------------+--------+----------------------+
      | crpd50616s9a2t7gr8mi | my-reg | b1g88tflru0ek1omtsu0 |
      +----------------------+--------+----------------------+
      

    To create a registry, use the create method for the Registry resource.

    If you don't have Terraform, install it and configure the Yandex.Cloud provider.

    1. To a configuration file, add the parameters of the registry that you want to create. For example, you can use the file example.tf from the ~/yandex-cloud-terraform directory:

      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: ID of the folder.
      • labels: Set of labels.

      For more information about the resources you can create using Terraform, see the provider documentation.

    2. Check that the configuration file is correct.

      1. Use the command line to go to the directory where you saved the configuration file:

        cd /Users/<username>/yandex-cloud-terraform
        
      2. Run the check using the command:

        terraform plan
        

        Command execution result:

        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 didn't specify an "-out" parameter to save this plan, so Terraform
        can't guarantee that exactly these actions will be performed if
        "terraform apply" is subsequently run.
        
    3. Create a registry.

      1. Run the command:

        terraform apply
        

        Command execution result:

        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:
        
      2. Confirm creation of the registry. To do this, type yes and press Enter:

        Enter a value: yes
        

        Command execution result:

        yandex_container_registry.default: Creating...
        yandex_container_registry.default: Creation complete after 4s [id=crpuljdfqoj3ve9mtbt1]
        
        Apply complete! Resources: 1 added, 0 changed, 0 destroyed.
        

        A registry named my-registry is created in the folder.

      3. Check the resources and their settings in the management console.

    Language / Region
    Careers
    Privacy policy
    Terms of use
    Brandbook
    © 2021 Yandex.Cloud LLC