Getting started with SonarQube container scanning

20 minutes to complete

Overview

Container scanning in SonarQube Cloud extends SonarQube Advanced Security to container images. It checks an image’s operating system packages, language runtimes, and libraries for known vulnerabilities and malicious packages.

In this course, you’ll scan the public container image alpine:3.19. You’ll pull it into Docker and scan the local image, then scan the image from a saved tar file and from an Open Container Initiative (OCI) layout. Finally, you’ll run the same scan in a continuous integration (CI) pipeline.

Learning objectives

After completing this course, you'll be able to:

  • Describe the types of risks container scanning reports.

  • Identify the image inputs the scanner accepts.

  • Set up the scanner with a user token.

  • Set the identity information (registry, repository, and tag) stored with a scan.

  • Scan a public image in the local Docker daemon.

  • Scan an image from a tar file or an OCI layout.

  • Run a scan in GitHub Actions on a pulled or newly built image.

  • Read an image’s versions and dependency risks in SonarQube Cloud.

  • Troubleshoot common container scanning errors.

Key topics

  • SonarQube container image scan
  • Local Docker image scan
  • tar file image scan
  • OCI layout image scan
  • Image scan in a CI pipeline

Target audience

  • Developers
  • DevOps engineers

Prerequisites

  • You have a terminal.
  • You’ve installed Docker, and it’s running. The docker images command should run without errors.
  • You’ve installed skopeo. You’ll use it to copy an image into an OCI layout. On macOS with Homebrew, run the command brew install skopeo.
  • Your organization is on SonarQube Cloud, Team plan or SonarQube Cloud, Enterprise plan. Those plans include SonarQube Advanced Security.
  • You’re a member of that organization.
  • You have a user token and the token owner must also be a member.
  • You have a GitHub repository with GitHub Actions enabled and permission to add a workflow. The repository can be empty.