Skip to content
Latchkey

gcloud artifacts repositories create: Usage & CI Errors

Create an Artifact Registry repository for Docker, npm, Maven, or more.

gcloud artifacts repositories create provisions an Artifact Registry repository - Google’s successor to Container Registry - to store container images or language packages used by your pipelines.

What it does

The command creates a repository of a given --repository-format (docker, npm, maven, python, apt, yum) in a --location. For Docker, you then authenticate Docker to the registry host with gcloud auth configure-docker <region>-docker.pkg.dev before pushing images.

Common usage

Terminal
# Create a Docker repository
gcloud artifacts repositories create my-repo \
  --repository-format=docker \
  --location=us-central1 \
  --description="App images"

# Configure Docker to push to it
gcloud auth configure-docker us-central1-docker.pkg.dev

Common error in CI: "denied: Permission ... denied on docker push" / wrong host

After creating the repo, docker push fails with "denied: Permission \"artifactregistry.repositories.uploadArtifacts\" denied" or "unauthorized" because Docker was never pointed at the Artifact Registry host. Fix: run gcloud auth configure-docker <region>-docker.pkg.dev (note the per-region host, e.g. us-central1-docker.pkg.dev - not gcr.io) so credentials are wired into Docker’s config, and grant the pushing identity roles/artifactregistry.writer. The full image path is <region>-docker.pkg.dev/PROJECT/REPO/IMAGE:TAG.

Key options

OptionPurpose
--repository-formatdocker, npm, maven, python, apt, yum
--locationRegion (e.g. us-central1)
--descriptionHuman-readable description
gcloud auth configure-docker HOSTWire Docker auth to the registry

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →