Container and Package Registry Management
Beginner8 min
Create Artifact Registry repositories, push and pull container images, and manage npm and Python packages in a private registry.
Prerequisites
- -gcloud CLI installed
- -Docker installed
- -Artifact Registry API enabled
Steps
1
Enable the Artifact Registry API
Activates the Artifact Registry API for the project.
$ gcloud services enable artifactregistry.googleapis.com
2
Create a Docker repository
Creates a Docker repository in the specified region.
$ gcloud artifacts repositories create my-docker-repo --repository-format docker --location us-central1 --description "Docker images for my apps"
3
Configure Docker authentication
Registers the Artifact Registry domain with Docker so you can push and pull images.
$ gcloud auth configure-docker us-central1-docker.pkg.dev
4
Tag and push an image
Tags a local image with the Artifact Registry path and pushes it.
$ docker tag myapp:latest us-central1-docker.pkg.dev/my-project-id/my-docker-repo/myapp:v1.0 && docker push us-central1-docker.pkg.dev/my-project-id/my-docker-repo/myapp:v1.0
5
List images in the repository
Shows all images in the repository with version tags and creation dates.
$ gcloud artifacts docker images list us-central1-docker.pkg.dev/my-project-id/my-docker-repo --format "table(package, version, createTime)"
Full Script
FAQ
Discussion
Loading comments...