Smaller images are more secure (most of the time)
Less surface area = fewer libraries = fewer CVEs. Slim/distroless/scratch all carry less risk than a full Debian or Ubuntu image. Size is also faster to pull, cheaper to store, and faster to scan.
Scan in CI, fail on critical CVEs
Docker Scout ships with Docker Desktop. Trivy is a popular open-source alternative. Both scan an image for known CVEs in OS packages and language-level dependencies. Run them in your build pipeline and fail the build on Critical/High findings.