Scanning a docker image

Xygeni docker image scan

Xygeni is capable of identifying vulnerabilities in Docker images.

Please note that not all scan commands are available for image scanning. Visit this to see which scan commands are available for image scanning.

For running a scan over a container image:

Docker image

Use --image to pass the image name, including the registry host, the namespace and the repository, plus tag or the image SHA digest.

The image name follows the [HOST[:PORT_NUMBER]/][NAMESPACE/]REPOSITORY[:TAG|@DIGEST]convention, see docker convention for more details.

For multi-platform images, the --image-platform OS/ARCH could be provided. When not given, the platform where the scanner runs will be used.

Docker image Sources

Specify in --image-sources the comma-separated list of sources where the image could be pulled.

The following are the supported sources:

  • docker: the local docker engine will be used when available.

  • containerd: the containerd daemon, via nerdctl, will be used when available.

  • podman: the podman cli will be used when available.

  • remote: pull image directly from a remote OCI registry, using the OCI distribution api.

  • tarball:<path>: when the image contents are available locally, the path should point to the directory or tar file with the image contents. The image ("tarball") is expected to be in the OCI format.

The default is first try with docker, then with containerd, then via podman and then remote as last option.

If the image was already pulled locally, scan times may improve. It could be convenient to use a local runtime if the image to analyze has already been pulled.

The remote source needs credentials for remote registries. See container registry configuration for details. For other image sources, an authenticated session in the underlying runtime is required. For example, via docker login for docker engine, nerdctl login for containerd, or podman login for podman.

Docker image Layers

As container images are made of layers, for some scans like secrets it is convenient to scan the contents of each layer separately.

The --image-scope controls which layers to consider and how the scan proceeds, either layer-by-layer or on the merged filesystem combining all layers.

--image-scope value
Mode of operation
Layers to process

merged

combined filesystem

all

mergedExceptBase

combined filesystem

all except base image

byLayer

layer by layer

all

byLayerExceptBase

layer by layer

all except base image

Container Registry configuration

The configuration file xygeni.yml contains sections where each external system is configured.

As the scanner often runs without user interaction, for example in a CI/CD pipeline, authentication is often done via access tokens that are ephemeral and generated following an authentication workflow (SAML, OIDC and JSON web tokens are often used in CI/CD systems).

Once a valid access token is available, it is often stored in a configuration file, environment variable, or in a secret vault managed by the CI/CD system. Configuration for an external system uses a token source that fetches the token from a list of environment variables or files.

For pulling images from container registries, or storing attestations in OCI registries, the containerRegistry section configures the location and sources of access tokens for each registry. For example, for Docker Hub:

Last updated