Organízate con las colecciones
Guarda y clasifica el contenido según tus preferencias.
Analizar paquetes de Go automáticamente
Aprende a habilitar el análisis automático, a enviar una imagen de contenedor a Artifact Registry y a ver una lista de las vulnerabilidades encontradas en la imagen.
Artifact Analysis busca vulnerabilidades cada vez que se envía una imagen a Artifact Registry. Los administradores de plataformas y los desarrolladores de aplicaciones pueden usar esta función de análisis automático para identificar riesgos en su canalización de entrega de software.
En esta guía de inicio rápido se usa un paquete sencillo disponible públicamente para mostrar un tipo de análisis de paquetes. De forma predeterminada, Artifact Analysis busca vulnerabilidades en varios tipos de paquetes una vez que habilitas la API de análisis.
Entre los tipos de paquetes admitidos se incluyen OS, Go, Java (Maven), Python y Node.js (npm).
Antes de empezar
Sign in to your Google Cloud account. If you're new to
Google Cloud,
create an account to evaluate how our products perform in
real-world scenarios. New customers also get $300 in free credits to
run, test, and deploy workloads.
En la página Create Repository (Crear repositorio), introduce los siguientes ajustes:
Nombre:quickstart-docker-repo
Formato: Docker
Modo: Estándar
Tipo de ubicación: región
Región:us-central1
Haz clic en Crear.
Verás la página Repositorios. Tu repositorio quickstart-docker-repo se añade a la lista de repositorios.
Configurar la autenticación
Para poder enviar o extraer imágenes con Artifact Registry, debes configurar Docker para que use Google Cloud CLI y autentique las solicitudes a Artifact Registry.
En Cloud Shell o en tu shell local, configura la autenticación para los repositorios de Docker en la región us-central1:
us-central1 es la región del repositorio de Artifact Registry.
docker.pkg.dev es el nombre de host de los repositorios de Docker.
quickstart-image es el nombre de la imagen que quieres usar en el repositorio.
El nombre de la imagen puede ser diferente del nombre de la imagen local.
tag1 es una etiqueta que vas a añadir a la imagen Docker. Si no has especificado ninguna etiqueta, Docker aplicará la etiqueta predeterminada latest.
Enviar la imagen a Artifact Registry
Artifact Analysis analiza automáticamente los paquetes Go nuevos cuando se suben a Artifact Registry.
Para enviar tu imagen a tu repositorio de Docker en Artifact Registry, ejecuta el siguiente comando:
En la lista de imágenes, haz clic en el nombre de una imagen.
Los totales de vulnerabilidades de cada digest de imagen se muestran en la columna Vulnerabilidades.
Para ver la lista de vulnerabilidades de una imagen, haga clic en el enlace de la columna Vulnerabilidades.
En la sección Resultados del análisis se muestra un resumen de los tipos de paquetes analizados, el número total de vulnerabilidades, las vulnerabilidades con correcciones disponibles, las vulnerabilidades sin correcciones y la gravedad efectiva.
En la tabla de vulnerabilidades se indica el nombre de la lista Common Vulnerabilities and Exposures (CVE) de cada vulnerabilidad detectada, la gravedad efectiva, la puntuación del sistema de puntuación Common Vulnerability Scoring System (CVSS), las correcciones (si están disponibles), el nombre del paquete que contiene la vulnerabilidad y el tipo de paquete.
Puedes filtrar y ordenar estos archivos para consultar un archivo, un directorio o un tipo de archivo específico por extensión.
Google Cloud La consola muestra hasta 1200 vulnerabilidades en esta tabla. Si tu imagen tiene más de 1200 vulnerabilidades, debes usar gcloud o la API para ver la lista completa.
Para obtener información sobre una CVE específica, haz clic en su nombre.
Para ver los detalles de la vulnerabilidad, como el número de versión y la ubicación afectada, haga clic en Ver o Ver corregido en la fila con el nombre de la vulnerabilidad. El texto del enlace es Ver para las vulnerabilidades sin corrección y Ver corregidas para las vulnerabilidades en las que se ha aplicado una corrección.
Limpieza
Para evitar que se apliquen cargos en tu Google Cloud cuenta por los recursos utilizados en esta página, elimina el Google Cloud proyecto con los recursos.
Si has creado un proyecto para esta guía, ahora puedes eliminarlo.
[[["Es fácil de entender","easyToUnderstand","thumb-up"],["Me ofreció una solución al problema","solvedMyProblem","thumb-up"],["Otro","otherUp","thumb-up"]],[["Es difícil de entender","hardToUnderstand","thumb-down"],["La información o el código de muestra no son correctos","incorrectInformationOrSampleCode","thumb-down"],["Me faltan las muestras o la información que necesito","missingTheInformationSamplesINeed","thumb-down"],["Problema de traducción","translationIssue","thumb-down"],["Otro","otherDown","thumb-down"]],["Última actualización: 2025-08-21 (UTC)."],[[["\u003cp\u003eArtifact Analysis automatically scans newly pushed images to Artifact Registry for vulnerabilities, which helps identify risks in the software delivery pipeline.\u003c/p\u003e\n"],["\u003cp\u003eThis process involves creating a Docker repository in Artifact Registry, configuring authentication, obtaining and tagging a package with a repository name, and then pushing the image to the registry.\u003c/p\u003e\n"],["\u003cp\u003eSupported package types for automatic vulnerability scanning include OS, Go, Java (Maven), Python, and Node.js (npm) packages.\u003c/p\u003e\n"],["\u003cp\u003eThe vulnerability scanning results, including CVE names, severity levels, and available fixes, can be viewed in the Google Cloud console by navigating through the repositories and images.\u003c/p\u003e\n"],["\u003cp\u003eEnabling the Container Scanning API starts billing immediately, and users can delete the entire project or selected resources within the project to avoid incurring charges.\u003c/p\u003e\n"]]],[],null,["Scan Go packages automatically Learn how to enable automatic scanning, push a container image on Artifact Registry,\nand see a list of any vulnerabilities found in the image.\n\nArtifact Analysis scans for vulnerabilities each time an image is\npushed to Artifact Registry. Platform administrators and application developers can\nuse this automatic scanning feature to help identify risks in their software\ndelivery pipeline.\n\nThis quickstart uses a simple publicly available package to demonstrate one type\nof package scanning. By default, Artifact Analysis scans for\nvulnerabilities in multiple package types once you enable the scanning API.\nSupported package types include: OS, Go, Java (Maven), Python and Node.js (npm).\n\nBefore you begin\n\n- Sign in to your Google Cloud account. If you're new to Google Cloud, [create an account](https://console.cloud.google.com/freetrial) to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.\n-\n [Install](/sdk/docs/install) the Google Cloud CLI.\n\n- If you're using an external identity provider (IdP), you must first\n [sign in to the gcloud CLI with your federated identity](/iam/docs/workforce-log-in-gcloud).\n\n-\n To [initialize](/sdk/docs/initializing) the gcloud CLI, run the following command:\n\n ```bash\n gcloud init\n ```\n- [Create or select a Google Cloud project](https://cloud.google.com/resource-manager/docs/creating-managing-projects).\n\n | **Note**: If you don't plan to keep the resources that you create in this procedure, create a project instead of selecting an existing project. After you finish these steps, you can delete the project, removing all resources associated with the project.\n - Create a Google Cloud project:\n\n ```\n gcloud projects create PROJECT_ID\n ```\n\n Replace \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e with a name for the Google Cloud project you are creating.\n - Select the Google Cloud project that you created:\n\n ```\n gcloud config set project PROJECT_ID\n ```\n\n Replace \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e with your Google Cloud project name.\n-\n [Verify that billing is enabled for your Google Cloud project](/billing/docs/how-to/verify-billing-enabled#confirm_billing_is_enabled_on_a_project).\n\n-\n\n\n Enable the Artifact Registry and Container Scanning APIs:\n\n\n ```bash\n gcloud services enable containerscanning.googleapis.com artifactregistry.googleapis.com\n ```\n\n-\n [Install](/sdk/docs/install) the Google Cloud CLI.\n\n- If you're using an external identity provider (IdP), you must first\n [sign in to the gcloud CLI with your federated identity](/iam/docs/workforce-log-in-gcloud).\n\n-\n To [initialize](/sdk/docs/initializing) the gcloud CLI, run the following command:\n\n ```bash\n gcloud init\n ```\n- [Create or select a Google Cloud project](https://cloud.google.com/resource-manager/docs/creating-managing-projects).\n\n | **Note**: If you don't plan to keep the resources that you create in this procedure, create a project instead of selecting an existing project. After you finish these steps, you can delete the project, removing all resources associated with the project.\n - Create a Google Cloud project:\n\n ```\n gcloud projects create PROJECT_ID\n ```\n\n Replace \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e with a name for the Google Cloud project you are creating.\n - Select the Google Cloud project that you created:\n\n ```\n gcloud config set project PROJECT_ID\n ```\n\n Replace \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e with your Google Cloud project name.\n-\n [Verify that billing is enabled for your Google Cloud project](/billing/docs/how-to/verify-billing-enabled#confirm_billing_is_enabled_on_a_project).\n\n-\n\n\n Enable the Artifact Registry and Container Scanning APIs:\n\n\n ```bash\n gcloud services enable containerscanning.googleapis.com artifactregistry.googleapis.com\n ```\n\n| **Important:** When you enable the Container Scanning API, billing begins immediately. Once you enable the API for a project, Artifact Analysis automatically scans each newly pushed image to Artifact Registry in that project.\n\nCreate a Docker repository in Artifact Registry\n\nCreate a Docker repository to store the sample image for this quickstart.\n\n1. Open the **Repositories** page in the Google Cloud console.\n\n [Open the Repositories page](https://console.cloud.google.com/artifacts)\n2. Click **Create Repository**.\n\n3. On the **Create Repository** page, input the following settings:\n\n - **Name** : `quickstart-docker-repo`\n - **Format**: Docker\n - **Mode**: Standard\n - **Location type**: Region\n - **Region** : `us-central1`\n4. Click **Create**.\n\nYou see the **Repositories** page. Your `quickstart-docker-repo` repository is added to the repository list.\n\nConfigure authentication\n\nBefore you can push or pull images with Artifact Registry, you must configure Docker to use the Google Cloud CLI to authenticate requests to Artifact Registry.\n\nIn the Cloud Shell or your local shell, set up authentication for Docker repositories in the region `us-central1`: \n\n gcloud auth configure-docker us-central1-docker.pkg.dev\n\nObtain a package\n\n1. Change to a directory where you want to save your container image.\n\n2. Copy an image into your local directory. For example, you can use Docker to pull the latest Go image from [Docker Hub](https://hub.docker.com/_/golang).\n\n docker pull golang:1.17.6-alpine\n\nTag your package with a repository name\n\nWhen you want to push a package to Artifact Registry, you need to configure the `docker push` command to push the image to a specific location.\n\nRun the following command to tag the image as `quickstart-image:tag1`: \n\n```bash\ndocker tag golang:1.17.6-alpine \\\nus-central1-docker.pkg.dev/PROJECT/quickstart-docker-repo/quickstart-image:tag1\n```\n\nWhere:\n\n- \u003cvar translate=\"no\"\u003ePROJECT\u003c/var\u003e is 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- `us-central1` is the Artifact Registry repository region.\n- `docker.pkg.dev` is the hostname for Docker repositories.\n- `quickstart-image` is the image name you want to use in the repository. The image name can be different than the local image name.\n- `tag1` is a tag you're adding to the Docker image. If you didn't specify a tag, Docker will apply the default tag `latest`.\n\nPush the image to Artifact Registry\n\nArtifact Analysis automatically scans new Go packages when they're uploaded to\nArtifact Registry.\n\nTo push your image to your Docker repository in Artifact Registry, run the following command: \n\n```bash\ndocker push us-central1-docker.pkg.dev/PROJECT/quickstart-docker-repo/quickstart-image:tag1\n```\n\nReplace \u003cvar translate=\"no\"\u003ePROJECT\u003c/var\u003e with your Google Cloud\n[project ID](/resource-manager/docs/creating-managing-projects#identifying_projects).\nIf your project ID contains a colon (`:`), see\n[Domain-scoped projects](/artifact-registry/docs/docker/names#domain).\n\nView vulnerability scanning results\n\nTo see the vulnerabilities in an image:\n\n1. Get the list of repositories.\n\n [Open the Repositories page](https://console.cloud.google.com/artifacts)\n2. In the repositories list, click a repository.\n\n3. In the images list, click an image name.\n\n Vulnerability totals for each image digest are displayed in the\n **Vulnerabilities** column.\n\n4. To view the list of vulnerabilities for an image, click the link in the\n **Vulnerabilities** column.\n\n The **Scan results** section displays a summary of the package types\n scanned, total vulnerabilities, vulnerabilities with fixes available,\n vulnerabilities without fixes, and effective severity.\n\n The table of vulnerabilities lists the Common Vulnerabilities and Exposures\n (CVE) name for each vulnerability found, the\n [effective severity](/artifact-analysis/docs/severity-levels),\n Common Vulnerability Scoring System (CVSS) score, fixes (when available),\n the name of the package that contains the vulnerability, and the package\n type. You can filter and sort these files to check a specific file, directory,\n or type of file by file extension. Google Cloud console displays up to\n 1200 vulnerabilities per page in this table.\n5. For details about a specific CVE, click the CVE name.\n\n6. To view vulnerability occurrence details such as version number and affected\n location, click **View** or **View Fixed** in the row with the name of the vulnerability. The link text is **View** for vulnerabilities without a fix, and **View Fixed** for vulnerabilities where a fix has been applied.\n\nClean up\n\n\nTo avoid incurring charges to your Google Cloud account for\nthe resources used on this page, delete the Google Cloud project with the\nresources.\nIf you created a new project for this guide, you can now delete the project.\n\n\u003cbr /\u003e\n\n| **Caution** : Deleting a project has the following effects:\n|\n| - **Everything in the project is deleted.** If you used an existing project for the tasks in this document, when you delete it, you also delete any other work you've done in the project.\n| - **Custom project IDs are lost.** When you created this project, you might have created a custom project ID that you want to use in the future. To preserve the URLs that use the project ID, such as an `appspot.com` URL, delete selected resources inside the project instead of deleting the whole project.\n|\n|\n| If you plan to explore multiple architectures, tutorials, or quickstarts, reusing projects\n| can help you avoid exceeding project quota limits.\n1. Delete a Google Cloud project: \n\n```\ngcloud projects delete PROJECT_ID\n```\n\nWhat's next\n\n- [Explore on-demand scanning options](/artifact-analysis/docs/on-demand-scanning-howto).\n- [Understand container scanning concepts](/artifact-analysis/docs/artifact-analysis)."]]