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 documentation on the Terraform
If you don't have Terraform, install it and configure the Yandex Cloud provider.
-
Describe the parameters of the
yandex_container_repository
resource 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
name
is 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, change to the folder where you edited the configuration file.
-
Make sure the configuration file is correct using the command:
terraform validate
If the configuration is correct, the following message is returned:
Success! The configuration is valid.
-
Run the command:
terraform plan
The terminal will display a list of resources with parameters. No changes are made at this step. If the configuration contains errors, Terraform will point them out.
-
Apply the configuration changes:
terraform apply
-
Confirm the changes: type
yes
in the terminal and press Enter.
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.