You push a container image to Amazon ECR . Is it safe to run?
There are two common ways to answer that on AWS. You can use AWS's own scanning (ECR basic scanning, or Amazon Inspector), or an open-source scanner like Trivy running in your CI. This post explains both from scratch, compares them, and shows a practical Trivy setup in GitHub Actions. That setup also covers the one thing people usually forget: images that are already running.
No prior Trivy knowledge needed.
What is Trivy?
Trivy is an open-source security scanner from Aqua Security. It's a single binary that you point at a target , and it reports problems.
Targets it can scan:
container images ( trivy image )
a local folder or a git repository ( trivy fs , trivy repo )
Infrastructure as Code: Terraform, CloudFormation, Dockerfiles, Kubernetes manifests ( trivy config )
a Kubernetes cluster ( trivy k8s )
an existing SBOM ( trivy sbom )
What it looks for (called scanners ):
vuln : known CVEs in OS packages (apk, apt, rpm…) and language…