Stay organized with collectionsSave and categorize content based on your preferences.
Scan Go packages automatically
Learn how to enable automatic scanning, push a container image on Artifact Registry,
and see a list of any vulnerabilities found in the image.
Artifact Analysis scans for vulnerabilities each time an image is
pushed to Artifact Registry. Platform administrators and application developers can
use this automatic scanning feature to help identify risks in their software
delivery pipeline.
This quickstart uses a simple publicly available package to demonstrate one type
of package scanning. By default, Artifact Analysis scans for
vulnerabilities in multiple package types once you enable the scanning API.
Supported package types include: OS, Go, Java (Maven), Python and Node.js (npm).
Before you begin
Sign in to your Google Cloud account. If you're new to
Google Cloud,create an accountto evaluate how our products perform in
real-world scenarios. New customers also get $300 in free credits to
run, test, and deploy workloads.
On theCreate Repositorypage, input the following settings:
Name:quickstart-docker-repo
Format: Docker
Mode: Standard
Location type: Region
Region:us-central1
ClickCreate.
You see theRepositoriespage. Yourquickstart-docker-reporepository is added to the repository list.
Configure authentication
Before 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.
In the Cloud Shell or your local shell, set up authentication for Docker repositories in the regionus-central1:
Vulnerability totals for each image digest are displayed in theVulnerabilitiescolumn.
To view the list of vulnerabilities for an image, click the link in theVulnerabilitiescolumn.
TheScan resultssection displays a summary of the package types
scanned, total vulnerabilities, vulnerabilities with fixes available,
vulnerabilities without fixes, and effective severity.
The table of vulnerabilities lists the Common Vulnerabilities and Exposures
(CVE) name for each vulnerability found, theeffective severity,
Common Vulnerability Scoring System (CVSS) score, fixes (when available),
the name of the package that contains the vulnerability, and the package
type. You can filter and sort these files to check a specific file, directory,
or type of file by file extension. Google Cloud console displays up to
1200 vulnerabilities per page in this table.
For details about a specific CVE, click the CVE name.
To view vulnerability occurrence details such as version number and affected
location, clickVieworView Fixedin the row with the name of the vulnerability. The link text isViewfor vulnerabilities without a fix, andView Fixedfor vulnerabilities where a fix has been applied.
Clean up
To avoid incurring charges to your Google Cloud account for
the resources used on this page, delete the Google Cloud project with the
resources.
If you created a new project for this guide, you can now delete the project.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-05 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)."]]