Skip to content

Container images

image: <name>:<tag> resolves the tag to the digest of its manifest. For a multi-arch image that is the digest of the index, so a new build for any platform changes it.

scope:
  source: ["compose.yaml", "**/*.go"]
  resolve:
    - image: postgres:16                     # Docker Hub
    - image: ghcr.io/acme/orders-db:nightly  # any OCI registry
  • A name without a host is a Docker Hub name: postgres:16 is docker.io/library/postgres:16, and so are docker.io/postgres:16 and index.docker.io/postgres:16. No tag means latest.
  • The digest Aval reads is the registry's, not the runner's. Compose without pull_policy: always, or Kubernetes with IfNotPresent, can run a copy pulled earlier: pull before the test, or pin by digest.
  • Also covers what the scanner cannot see, such as Helm values that split repository and tag: declare the image those values make.
  • An image test code starts through testcontainers is declared the same way. The scanner reports the literal; resolving the tag puts its digest in the fingerprint:

    // db_test.go
    pg, err := postgres.Run(ctx, "postgres:16")
    
    scope:
      source: ["**/*.go"]
      resolve:
        - image: postgres:16
      allowMutable:
        - ref: postgres:16
          reason: resolved in scope.resolve
    
  • Credentials come from docker login ($DOCKER_CONFIG). A loopback registry (localhost:5000) is reached over plain HTTP.

scope.resolve never clears a scanner finding: a move changes the fingerprint, but the reference still blocks reuse. Pin it in place, or accept it with scope.allowMutable.

Pin instead when you want what you run to be exactly what you hashed: image: postgres:16@sha256:<digest> in the file. Find the digest with crane digest postgres:16.