Next, Amazon ECR is a service that manages container registries for storing, managing, and deploying container images.
If you’re managing your user docker images with AWS ECR, you can scan your images that help to improve the security of your application’s container images.
Additionally, you can enable the “scans on push” feature for your repositories to ensure every image automatically goes through a vulnerability scanning.
AWS ECR uses CVE databases for findings. To enable scan on push feature:
After pushing your docker images to the cloud, you could see your scan results on the AWS console in detail.
After you get results, you can fix vulnerabilities with security updates.
Trivy
Finally, Trivy is an open-source vulnerability scanner for your docker images announced by Aqua Security.
In addition to docker images, Trivy can scan your filesystems and git repositories for you.
It can detect vulnerabilities in minutes and be suitable for CI & CD processes. Trivy can install in many Linux distributions easily.
It lists vulnerabilities and related libraries with detailed information such as installed library version on the docker, the fixed version that should installed, severity level, etc.
To install all related packages and Docker Bench for Security on Ubuntu 20.04:
$ sudo apt-get install wget apt-transport-https gnupg lsb-release
$ wget -qO - https://aquasecurity.github.io/trivy-repo/deb/public.key | sudo apt-key add -
$ echo deb https://aquasecurity.github.io/trivy-repo/deb $(lsb_release -sc) main | sudo tee -a /etc/apt/sources.list.d/trivy.list
$ sudo apt-get update
$ sudo apt-get install trivy