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 relevant documentation on the Terraform
If you do not have Terraform yet, install it and configure the Yandex Cloud provider.
-
Describe the parameters of the
yandex_container_repositoryresource 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
nameis the repository name in<registry_ID>/<repository_name>format. You can retrieve registry ID from the folder registry list.For more information about the resources you can create with Terraform, see the provider documentation.
-
Create resources:
-
In the terminal, go to the directory where you edited the configuration file.
-
Make sure the configuration file is correct using this command:
terraform validateIf the configuration is correct, you will get this message:
Success! The configuration is valid. -
Run this command:
terraform planYou will see a detailed list of resources. No changes will be made at this step. If the configuration contains any errors, Terraform will show them.
-
Apply the changes:
terraform apply -
Type
yesand press Enter to confirm the changes.
Terraform will create all the required resources. You can check the new resources using the management console
or 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.