Creating a repository
Note
A repository will only be displayed after you push a Docker image to it.
To create a repository:
With Terraform
Terraform is distributed under the Business Source License
For more information about the provider resources, see the guides on the Terraform
If you do not have Terraform yet, install it and configure the Yandex Cloud provider.
To manage infrastructure using Terraform under a service account or user accounts (a Yandex account, a federated account, or a local user), authenticate using the appropriate method.
-
Specify the
yandex_container_repositoryproperties in the configuration file: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-nameis the repository name in<registry_ID>/<repository_name>format. You can retrieve registry ID from the folder registry list.For more on the properties of the
yandex_container_repositoryresource, see this provider guide. -
Create the resources:
-
In the terminal, navigate to the configuration file directory.
-
Make sure the configuration is correct using this command:
terraform validateIf the configuration is valid, you will get this message:
Success! The configuration is valid. -
Run this command:
terraform planYou 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.
-
Apply the configuration changes:
terraform apply -
Type
yesand press Enter to confirm the changes.
Terraform will create all the required resources. You can check the new resources in the management console
or using this CLI command:yc container repository list --registry-id <registry_ID> -
To create a repository, use the upsert REST API method for the Repository resource or the RepositoryService/Upsert gRPC API call.