What is container image scanning and which tools are commonly used?

Answer

Container image scanning analyzes Docker images for known vulnerabilities in the OS packages, language runtimes, and libraries bundled inside the image. Because Docker images often include a full OS layer with dozens of packages, even official base images regularly contain CVEs (Common Vulnerabilities and Exposures). In CI/CD, image scanning runs after docker build and before pushing to the registry or deploying. Common tools include: Trivy (by Aqua Security, fast, open-source, scans images, filesystems, and git repos), Grype (by Anchore, open-source, comprehensive vulnerability database), Snyk Container (cloud service with developer-friendly reporting), and AWS Inspector (integrated with ECR). Best practice is to set a policy that blocks deployment of images with CRITICAL or HIGH severity CVEs, and to keep base images updated regularly. Use distroless or minimal base images (Alpine, Chainguard) to minimize the attack surface.