Search code examples
google-cloud-platformgcloud

gcloud create artifacts repository is not working


I have tried running the command below

gcloud artifacts repositories create gke-cloud-sql-repo --project=unimitra --repository-format=docker --location=asia-south1-b --description="GKE Quickstart sample app"

I have checked the project name and location both are correct. yet I am getting the error below

ERROR: (gcloud.artifacts.repositories.create) INVALID_ARGUMENT: invalid project: "projects/unimitra/locations/asia-south1-b"

Solution

  • I tried running the same command

    gcloud artifacts repositories create gke-cloud-sql-repo --project=project_ID --repository-format=docker --location=asia-south1-b --description="GKE Quickstart sample app"
    

    and got the same error

    ERROR: (gcloud.artifacts.repositories.create) INVALID_ARGUMENT: invalid project: "projects/project_ID/locations/asia-south1-b"
    

    You are trying to create an Artifact registry under the zone. Creating a Artifact Registry only supported under regions not zones. Try removing the zone -b by ruining the below command and it should work as expected:

    gcloud artifacts repositories create gke-cloud-sql-repo --project=project_ID --repository-format=docker --location=asia-south1 --description="GKE Quickstart sample app"
    

    To view a list of supported repository locations, run the command:

    gcloud artifacts locations list
    
    

    Or, Check this document to view the Available regions