How do you scan images in a container registry continuously?

IntermediateConceptTrivy
Answer

Short answer

Pipeline scans happen once at build time, but new CVEs appear daily. Rescan regularly using registry-native scanning (ECR enhanced scanning with Inspector, ACR + Defender for Cloud, Harbor with Trivy built in, GHCR + Dependabot) or a scheduled job that runs Trivy on the images currently deployed.

Options

Registry Continuous scanning
Amazon ECR Enhanced scanning (Amazon Inspector) — rescans on new CVEs
Azure ACR Microsoft Defender for Containers
Harbor Trivy built in; scan on push + scheduled; can block pulls of vulnerable images
GitLab Container scanning + "operational container scanning"

Scheduled job idea

# GitHub Actions: nightly rescan of what's in production
on: { schedule: [{ cron: "0 2 * * *" }] }
jobs:
  rescan:
    runs-on: ubuntu-latest
    steps:
      - run: |
          for img in $(cat prod-images.txt); do
            trivy image --severity CRITICAL --ignore-unfixed --exit-code 0 --format json -o "$(basename $img).json" "$img"
          done
      # → send summary to Slack / ticketing

What to say in the interview

"Build-time scans go stale, so we rescan continuously — ECR enhanced scanning, Defender for ACR or Harbor's built-in Trivy — or a nightly job over the images actually running, with alerts for new fixable criticals."

All Security Tools questions Roadmap: Trivy — image, file system & IaC scanning

More on Trivy