Mantenha tudo organizado com as coleções
Salve e categorize o conteúdo com base nas suas preferências.
Nesta página, descrevemos como fazer o download de arquivos individuais dos repositórios padrão e remotos do Artifact Registry.
O repositório pode ser de qualquer formato de artefato.
O download de arquivos pode ser útil quando você quer transferir arquivos para seu ambiente
local sem ferramentas específicas de formato. É necessário
fazer a autenticação no Artifact Registry antes de baixar arquivos.
Arquivos para download
Você pode baixar qualquer arquivo de dados ou metadados encontrado no seu repositório.
Por exemplo, um repositório Maven armazena pacotes Java como artefatos. Todos os arquivos
em um pacote Java, como arquivos jar e pom.xml, estão disponíveis
para download individualmente.
Não é recomendável usar esse recurso para artefatos que dependem muito de
ferramentas do cliente para operações de download, como imagens do Docker.
Para receber as permissões necessárias para
baixar arquivos armazenados em um repositório,
peça ao administrador para conceder a você o papel
Leitor do Artifact Registry (roles/artifactregistry.reader)
do IAM no repositório.
Para mais informações sobre a concessão de papéis, consulte Gerenciar o acesso a projetos, pastas e organizações.
LOCATION: o local regional ou multirregional do repositório.
REPOSITORY: o nome do repositório
em que o artefato está armazenado.
DESTINATION: o caminho para a
pasta de destino no seu sistema de arquivos local. A pasta de destino precisa existir ou o comando vai falhar.
FILE: o nome do arquivo codificado por URL. Para encontrar esse valor, execute o comando gcloud
artifacts files list e copie o valor de FILE. Ele precisa ser
convertido para o formato codificado em URL para esse comando. Por exemplo, path/to/file.jar
precisa ser inserido como path%2Fto%2Ffile.jar.
Método HTTP e URL:
GET https://artifactregistry.googleapis.com/download/v1/projects/PROJECT/locations/LOCATION/repositories/REPOSITORY/files/FILE:download?alt=media
Para enviar a solicitação, expanda uma destas opções:
[[["Fácil de entender","easyToUnderstand","thumb-up"],["Meu problema foi resolvido","solvedMyProblem","thumb-up"],["Outro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Informações incorretas ou exemplo de código","incorrectInformationOrSampleCode","thumb-down"],["Não contém as informações/amostras de que eu preciso","missingTheInformationSamplesINeed","thumb-down"],["Problema na tradução","translationIssue","thumb-down"],["Outro","otherDown","thumb-down"]],["Última atualização 2025-08-18 UTC."],[[["\u003cp\u003eThis guide details the process of downloading individual files from both standard and remote Artifact Registry repositories, regardless of the artifact format.\u003c/p\u003e\n"],["\u003cp\u003eYou can list the available files within a repository using either the Google Cloud console or the \u003ccode\u003egcloud\u003c/code\u003e command-line tool, specifying project, repository, location, package, and version details as needed.\u003c/p\u003e\n"],["\u003cp\u003eTo download a file, the \u003ccode\u003egcloud artifacts files download\u003c/code\u003e command can be used, or a direct download link through an HTTP GET request.\u003c/p\u003e\n"],["\u003cp\u003eDownloading files requires prior authentication to Artifact Registry and having the "Artifact Registry Reader" IAM role.\u003c/p\u003e\n"],["\u003cp\u003eIt is not recommended to use the download feature for artifacts that heavily depend on client tooling, like Docker images.\u003c/p\u003e\n"]]],[],null,["# Download files\n\nThis page describes how to download individual files from Artifact Registry\n[standard](/artifact-registry/docs/repositories/create-repos) repositories and [remote](/artifact-registry/docs/repositories/remote-repo) repositories.\nThe repository can be of any artifact [format](/artifact-registry/docs/supported-formats).\n\nDownloading files can be useful when you want to get files into your local\nenvironment without format-specific tooling. Note that you must still\nauthenticate to Artifact Registry before downloading files.\n\nDownloadable files\n------------------\n\nYou can download any individual data or metadata file found in your repository.\nFor example, a Maven repository will store Java packages as artifacts. Any files\nwithin a Java package, such as jar files and pom.xml files, are individually\navailable for download.\n\nUsing this feature is not recommended for artifacts that depend heavily on\nclient tooling for download operations, such as Docker images.\n\nBefore you begin\n----------------\n\n- (Optional) [Set defaults for gcloud CLI\n commands](/artifact-registry/docs/repositories/gcloud-defaults).\n\n### Required roles\n\n\nTo get the permissions that\nyou need to download files stored in a repository,\n\nask your administrator to grant you the\n\n\n[Artifact Registry Reader](/iam/docs/roles-permissions/artifactregistry#artifactregistry.reader) (`roles/artifactregistry.reader`)\nIAM role on the repository.\n\n\nFor more information about granting roles, see [Manage access to projects, folders, and organizations](/iam/docs/granting-changing-revoking-access).\n\n\nYou might also be able to get\nthe required permissions through [custom\nroles](/iam/docs/creating-custom-roles) or other [predefined\nroles](/iam/docs/roles-overview#predefined).\n\nList files\n----------\n\nYou can list files in a repository to see what is available for download. \n\n### console\n\n\n1. Open the **Repositories** page in the Google Cloud console.\n\n [Open the Repositories page](https://console.cloud.google.com/artifacts)\n2. In the repository list, select the repository.\n\n3. Click the name of the package.\n\n4. To view downloadable files for all package versions, click the **Files**\n tab.\n\n5. To view downloadable files for a specific version of your package, click\n the version name, and then click the **Files** tab.\n\n### gcloud\n\n\nFor all the following commands, you can set a maximum number of files to return\nby adding the `--limit` flag to the command.\n\nTo list all files in the default project, repository, and\nlocation when the [default values are configured](/artifact-registry/docs/repositories/gcloud-defaults): \n\n gcloud artifacts files list\n\nTo list files in a specified project, repository, and location, run the command: \n\n gcloud artifacts files list \\\n --project=\u003cvar translate=\"no\"\u003ePROJECT\u003c/var\u003e \\\n --repository=\u003cvar translate=\"no\"\u003eREPOSITORY\u003c/var\u003e \\\n --location=\u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e\n\nTo list files for all versions of a specific package: \n\n gcloud artifacts files list \\\n --project=\u003cvar translate=\"no\"\u003ePROJECT\u003c/var\u003e \\\n --repository=\u003cvar translate=\"no\"\u003eREPOSITORY\u003c/var\u003e \\\n --location=\u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e \\\n --package=\u003cvar translate=\"no\"\u003ePACKAGE\u003c/var\u003e\n\nTo list files for a specific package version: \n\n gcloud artifacts files list \\\n --project=\u003cvar translate=\"no\"\u003ePROJECT\u003c/var\u003e \\\n --repository=\u003cvar translate=\"no\"\u003eREPOSITORY\u003c/var\u003e \\\n --location=\u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e \\\n --package=\u003cvar translate=\"no\"\u003ePACKAGE\u003c/var\u003e \\\n --version=\u003cvar translate=\"no\"\u003eVERSION\u003c/var\u003e\n\nReplace the following values:\n\n- \u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e: the regional or multi-regional [location](/artifact-registry/docs/repo-locations) of the repository.\n- \u003cvar translate=\"no\"\u003ePROJECT\u003c/var\u003e: your Google Cloud [project ID](/resource-manager/docs/creating-managing-projects#identifying_projects). If your project ID contains a colon (`:`), see [Domain-scoped projects](/artifact-registry/docs/docker/names#domain).\n- \u003cvar translate=\"no\"\u003eREPOSITORY\u003c/var\u003e: the name of the repository where the image is stored.\n- \u003cvar translate=\"no\"\u003ePACKAGE\u003c/var\u003e: the name of the package.\n- \u003cvar translate=\"no\"\u003eVERSION\u003c/var\u003e: the version of the package.\n\nFor Docker repositories, you can list files for a specific container image tag\nby adding the `--tag` flag to the command.\n\nFor more information, see\n[gcloud artifacts files list](/sdk/gcloud/reference/artifacts/files/list).\n\nDownload files\n--------------\n\nTo download individual files from a repository, run the following command: \n\n### gcloud\n\n\nBefore using any of the command data below,\nmake the following replacements:\n\n- \u003cvar class=\"edit\" scope=\"PROJECT\" translate=\"no\"\u003ePROJECT\u003c/var\u003e: your Google Cloud [project ID](/resource-manager/docs/creating-managing-projects#identifying_projects). If your project ID contains a colon (`:`), see [Domain-scoped projects](/artifact-registry/docs/docker/names#domain).\n- \u003cvar class=\"edit\" scope=\"LOCATION\" translate=\"no\"\u003eLOCATION\u003c/var\u003e: the regional or multi-regional [location](/artifact-registry/docs/repo-locations) of the repository.\n- \u003cvar class=\"edit\" scope=\"REPOSITORY\" translate=\"no\"\u003eREPOSITORY\u003c/var\u003e: the name of the repository where the artifact is stored.\n- \u003cvar class=\"edit\" scope=\"DESTINATION\" translate=\"no\"\u003eDESTINATION\u003c/var\u003e: the path to the destination folder in your local file system. The destination folder must already exist or the command will fail.\n- \u003cvar class=\"edit\" scope=\"FILE\" translate=\"no\"\u003eFILE\u003c/var\u003e: the full filename. You can find this value by running the [`gcloud artifacts\n files list`](/sdk/gcloud/reference/artifacts/files/list) command and copying the value for `FILE`.\n\n\nExecute the\n\nfollowing\n\ncommand:\n\n#### Linux, macOS, or Cloud Shell\n\n**Note:** Ensure you have initialized the Google Cloud CLI with authentication and a project by running either [gcloud init](/sdk/gcloud/reference/init); or [gcloud auth login](/sdk/gcloud/reference/auth/login) and [gcloud config set project](/sdk/gcloud/reference/config/set). \n\n```bash\ngcloud artifacts files download \\\n --project=PROJECT \\\n --location=LOCATION \\\n --repository=REPOSITORY \\\n --destination=DESTINATION \\\n FILE\n```\n\n#### Windows (PowerShell)\n\n**Note:** Ensure you have initialized the Google Cloud CLI with authentication and a project by running either [gcloud init](/sdk/gcloud/reference/init); or [gcloud auth login](/sdk/gcloud/reference/auth/login) and [gcloud config set project](/sdk/gcloud/reference/config/set). \n\n```bash\ngcloud artifacts files download `\n --project=PROJECT `\n --location=LOCATION `\n --repository=REPOSITORY `\n --destination=DESTINATION `\n FILE\n```\n\n#### Windows (cmd.exe)\n\n**Note:** Ensure you have initialized the Google Cloud CLI with authentication and a project by running either [gcloud init](/sdk/gcloud/reference/init); or [gcloud auth login](/sdk/gcloud/reference/auth/login) and [gcloud config set project](/sdk/gcloud/reference/config/set). \n\n```bash\ngcloud artifacts files download ^\n --project=PROJECT ^\n --location=LOCATION ^\n --repository=REPOSITORY ^\n --destination=DESTINATION ^\n FILE\n```\nYou should see the download begin right away.\n\n\u003cbr /\u003e\n\n### API\n\n\nBefore using any of the request data,\nmake the following replacements:\n\n- \u003cvar class=\"edit\" scope=\"PROJECT\" translate=\"no\"\u003ePROJECT\u003c/var\u003e: your Google Cloud [project ID](/resource-manager/docs/creating-managing-projects#identifying_projects). If your project ID contains a colon (`:`), see [Domain-scoped projects](/artifact-registry/docs/docker/names#domain).\n- \u003cvar class=\"edit\" scope=\"LOCATION\" translate=\"no\"\u003eLOCATION\u003c/var\u003e: the regional or multi-regional [location](/artifact-registry/docs/repo-locations) of the repository.\n- \u003cvar class=\"edit\" scope=\"REPOSITORY\" translate=\"no\"\u003eREPOSITORY\u003c/var\u003e: the name of the repository where the artifact is stored.\n- \u003cvar class=\"edit\" scope=\"DESTINATION\" translate=\"no\"\u003eDESTINATION\u003c/var\u003e: the path to the destination folder in your local file system. The destination folder must already exist or the command will fail.\n- \u003cvar class=\"edit\" scope=\"ENC_FILE\" translate=\"no\"\u003eFILE\u003c/var\u003e: the url-encoded filename. You can find this value by running the [`gcloud\n artifacts files list`](/sdk/gcloud/reference/artifacts/files/list) command and copying the value for `FILE`. It must be converted to URL-encoded format for this command---for example, `path/to/file.jar` would need to be input as `path%2Fto%2Ffile.jar`.\n\n\nHTTP method and URL:\n\n```\nGET https://artifactregistry.googleapis.com/download/v1/projects/PROJECT/locations/LOCATION/repositories/REPOSITORY/files/FILE:download?alt=media\n```\n\nTo send your request, expand one of these options:\n\n#### curl (Linux, macOS, or Cloud Shell)\n\n\nExecute the following command:\n\n```\ncurl -X GET \\\n -H \"Authorization: Bearer $(gcloud auth print-access-token)\" \\\n --output DESTINATION \\\n \"https://artifactregistry.googleapis.com/download/v1/projects/PROJECT/locations/LOCATION/repositories/REPOSITORY/files/FILE:download?alt=media\"\n```\n\n#### PowerShell (Windows)\n\n\nExecute the following command:\n\n```\n$cred = gcloud auth print-access-token\n$headers = @{ \"Authorization\" = \"Bearer $cred\" }\n\nInvoke-WebRequest `\n -Method GET `\n -Headers $headers `\n -OutFile DESTINATION `\n -Uri \"https://artifactregistry.googleapis.com/download/v1/projects/PROJECT/locations/LOCATION/repositories/REPOSITORY/files/FILE:download?alt=media\"\n```\nYou should see the download begin right away.\n\n\u003cbr /\u003e\n\nWhat's next\n-----------\n\n- [View and list repositories](/artifact-registry/docs/repositories/list-repos)\n- [Label repositories](/artifact-registry/docs/repositories/label-repos)\n- [Tag repositories](/artifact-registry/docs/repositories/tag-repos)\n- [Delete repositories](/artifact-registry/docs/repositories/delete-repos)"]]