This page describes how to download individual files from Artifact Registry standard repositories and remote repositories. The repository can be of any artifact format.
Downloading files can be useful when you want to get files into your local environment without format-specific tooling. Note that you must still authenticate to Artifact Registry before downloading files.
Downloadable files
You can download any individual data or metadata file found in your repository. For example, a Maven repository will store Java packages as artifacts. Any files within a Java package, such as jar files and pom.xml files, are individually available for download.
Using this feature is not recommended for artifacts that depend heavily on client tooling for download operations, such as Docker images.
Before you begin
- (Optional) Set defaults for gcloud CLI commands.
Required roles
To get the permissions that you need to download files stored in a repository,
ask your administrator to grant you the
Artifact Registry Reader (roles/artifactregistry.reader
) IAM role on the repository.
For more information about granting roles, see Manage access to projects, folders, and organizations.
You might also be able to get the required permissions through custom roles or other predefined roles.
List files
You can list files in a repository to see what is available for download.
console
Open the Repositories page in the Google Cloud console.
In the repository list, select the repository.
Click the name of the package.
To view downloadable files for all package versions, click the Files tab.
To view downloadable files for a specific version of your package, click the version name, and then click the Files tab.
gcloud
For all the following commands, you can set a maximum number of files to return
by adding the --limit
flag to the command.
To list all files in the default project, repository, and location when the default values are configured:
gcloud artifacts files list
To list files in a specified project, repository, and location, run the command:
gcloud artifacts files list \
--project=PROJECT \
--repository=REPOSITORY \
--location=LOCATION
To list files for all versions of a specific package:
gcloud artifacts files list \
--project=PROJECT \
--repository=REPOSITORY \
--location=LOCATION \
--package=PACKAGE
To list files for a specific package version:
gcloud artifacts files list \
--project=PROJECT \
--repository=REPOSITORY \
--location=LOCATION \
--package=PACKAGE \
--version=VERSION
Replace the following values:
LOCATION
: the regional or multi-regional location of the repository.PROJECT
: your Google Cloud project ID. If your project ID contains a colon (`:`), see Domain-scoped projects.REPOSITORY
: the name of the repository where the image is stored.PACKAGE
: the name of the package.VERSION
: the version of the package.
For Docker repositories, you can list files for a specific container image tag
by adding the --tag
flag to the command.
For more information, see gcloud artifacts files list.
Download files
To download individual files from a repository, run the following command:
gcloud
Before using any of the command data below, make the following replacements:
PROJECT
: your Google Cloud project ID. If your project ID contains a colon (:
), see Domain-scoped projects.LOCATION
: the regional or multi-regional location of the repository.REPOSITORY
: the name of the repository where the artifact is stored.DESTINATION
: the path to the destination folder in your local file system. The destination folder must already exist or the command will fail.FILE
: the full filename. You can find this value by running thegcloud artifacts files list
command and copying the value forFILE
.
Execute the following command:
Linux, macOS, or Cloud Shell
gcloud artifacts files download \ --project=PROJECT \ --location=LOCATION \ --repository=REPOSITORY \ --destination=DESTINATION \ FILE
Windows (PowerShell)
gcloud artifacts files download ` --project=PROJECT ` --location=LOCATION ` --repository=REPOSITORY ` --destination=DESTINATION ` FILE
Windows (cmd.exe)
gcloud artifacts files download ^ --project=PROJECT ^ --location=LOCATION ^ --repository=REPOSITORY ^ --destination=DESTINATION ^ FILE
API
Before using any of the request data, make the following replacements:
PROJECT
: your Google Cloud project ID. If your project ID contains a colon (:
), see Domain-scoped projects.LOCATION
: the regional or multi-regional location of the repository.REPOSITORY
: the name of the repository where the artifact is stored.DESTINATION
: the path to the destination folder in your local file system. The destination folder must already exist or the command will fail.FILE
: the url-encoded filename. You can find this value by running thegcloud artifacts files list
command and copying the value forFILE
. It must be converted to URL-encoded format for this command—for example,path/to/file.jar
would need to be input aspath%2Fto%2Ffile.jar
.
HTTP method and URL:
GET https://artifactregistry.googleapis.com/download/v1/projects/PROJECT/locations/LOCATION/repositories/REPOSITORY/files/FILE:download?alt=media
To send your request, expand one of these options:
You should see the download begin right away.