YYYY-MM-DDTHH:MM:SS FATAL Fatal error image scan error: scan error: scan failed: failed analysis: analyze error: pipeline error: failed to analyze layer (sha256:deb7d8874f38d4ec281d990aac2c7badbfcd5b97d602a388056e3f918a3f8cc7): post analysis error: post analysis error: Unable to initialize the Java DB: Java DB update failed: OCI artifact error: failed to download Java DB: failed to download artifact from ghcr.io/aquasecurity/trivy-java-db:1: oci download error: copy error: write /tmp/trivy3011653552/javadb.tar.gz: no space left on device
: general response handler: unexpected status code: 500
Trivy uses the /tmp directory during image scanning. If the image is large or /tmp has insufficient space, the scan may fail. To address this, you can set the TMPDIR environment variable to redirect Trivy's temporary file usage to a directory with adequate storage.
1. Set Harbor as Read-Only mode on UI
Impact: Image uploads and deletion would fail, but docker push is expected to work.
2. Create add-trivy-tmpdir-overlay.yaml on the supervisor control plane node
#@ load("@ytt:overlay", "overlay")#@overlay/match by=overlay.and_op(overlay.subset({"kind": "StatefulSet"}), overlay.subset({"metadata": {"name": "harbor-trivy"}}))---spec: template: spec: containers: #@overlay/match by="name" - name: trivy env: #@overlay/append - name: "TMPDIR" value: /home/scanner/.cache # Corrected pathkubectl -n vmware-system-supervisor-services annotate packageinstalls svc-harbor.tanzu.vmware.com ext.packaging.carvel.dev/ytt-paths-from-secret-name.0=add-trivy-tmpdir-overlay5. Check if the reconciliation succeeded using the command:
watch kubectl get pkgi -n vmware-system-supervisor-services 6. Login to the pod and check if the TMPDIR variable is successfully changed:
kubectl exec -it harbor-trivy-0 -n svc-harbor-domain-c8 -- /bin/bash