KICS or Checkov on Kubernetes manifests flags "Container should not run as root" even though the image sets `USER 10001`
IntermediateTroubleshootingContainer image and IaC scanning
Answer
Likely causes → Manifest scanners only see YAML; they cannot read the image USER. Without runAsNonRoot in securityContext, the check fails.
Diagnose → Look for securityContext at pod and container level in the rendered manifest (helm template . | yq '.spec.template.spec').
Fix →
securityContext:
runAsNonRoot: true
runAsUser: 10001
allowPrivilegeEscalation: false
capabilities: { drop: ["ALL"] }
Prevent → Put the hardened securityContext in the shared Helm library chart so every service inherits it.
More on Container image and IaC scanning
Trivy fails the build on 14 HIGH/CRITICAL CVEs in the base image, all with "Fixed Version" emptyBeginner`FATAL ... failed to download vulnerability DB: ... TOOMANYREQUESTS: retry-after` from Trivy in CIIntermediateTrivy in an air-gapped runner fails with `failed to download vulnerability DB` even though you copied `db.tar.gz`AdvancedTrivy and Grype report different CVE counts for the same imageIntermediate`.trivyignore` entries are ignored and the build still fails on the same CVEBeginnerTrivy reports a critical CVE in a Go binary built from your own code, in package `stdlib`Intermediate