# Scan OS packages manually

This quickstart shows you how to pull a container image, manually scan it for operating system vulnerabilities with
the On-Demand Scanning API, and retrieve identified vulnerabilities. To follow this
quickstart you will use Cloud Shell and an example Ubuntu image.

## Before you begin

## Download and scan an image

1. Open a Cloud Shell in your project.

   [Open Cloud Shell](https://console.cloud.google.com/?cloudshell=true)

   This opens a terminal with all the required tools to follow this guide.
2. Use docker to pull the latest Ubuntu image.

       docker pull ubuntu:latest

3. Run the scan.

       gcloud artifacts docker images scan ubuntu:latest

   This triggers that scanning process and returns the scan name when finished:

   ```
   ✓ Scanning container image
     ✓ Locally extracting packages and versions from local container image
     ✓ Remotely initiating analysis of packages and versions
     ✓ Waiting for analysis operation to complete [projects/my-project/locations/us/operations/OPERATION_ID]
   Done.

   done: true
   metadata:
     '@type': type.googleapis.com/google.cloud.ondemandscanning.v1.AnalyzePackagesMetadata
     createTime: '2021-01-26T13:43:53.112123Z'
     resourceUri: ubuntu:latest
   name: projects/my-project/locations/us/operations/OPERATION_ID
   response:
     '@type': type.googleapis.com/google.cloud.ondemandscanning.v1.AnalyzePackagesResponse
     scan: projects/my-project/locations/us/scans/SCAN_ID
   ```
4. Use the scan name, the value of `scan` from the output, to fetch the scan results.

       gcloud artifacts docker images list-vulnerabilities \
       projects/my-project/locations/us/scans/SCAN_ID

## Clean up


To avoid incurring charges to your Google Cloud account for
the resources used on this page, follow these steps.
If you created a new project for this guide, you can now delete the project.

## What's next

- [Explore all the On-Demand Scanning API options](https://docs.cloud.google.com/artifact-analysis/docs/scan-os-on-demand).
- [Enable automated scanning](https://docs.cloud.google.com/artifact-analysis/docs/scan-os-automatically).
- [Understand container scanning concepts](https://docs.cloud.google.com/artifact-analysis/docs/container-scanning-overview).