Maintenance and Best Practices¶
Troubleshooting container builds, best practices, and included tools reference.
Troubleshooting¶
Build Failures¶
Problem: no such image when pulling policy repo
Cause: Policy repo not pushed or authentication failed
Solution: Verify policy repo exists and credentials are correct
# Test pulling policy repo
docker pull europe-west6-docker.pkg.dev/project/charts/security-policy-repo:main
# Check authentication
docker login europe-west6-docker.pkg.dev
Tool Installation Failures¶
Problem: curl: command not found
Cause: Tool not installed in base image
Solution: Install dependencies first
Large Image Size¶
Problem: Image exceeds 1GB
Cause: Build cache or unnecessary files included
Solution: Use multi-stage builds and .dockerignore
Debug with --no-cache
Build failures? Use docker build --no-cache to eliminate cached layer issues.
Best Practices¶
1. Pin All Versions¶
Tools:
Policy repos:
2. Layer Order Optimization¶
Put frequently changing layers last:
# Rarely changes - put first
RUN apk add curl bash
# Changes occasionally - put middle
COPY --from=security_policy_repo /repos/ /repos/
# Changes frequently - put last
COPY ./scripts/ /scripts/
3. Security Scanning¶
Scan every build:
4. Test Before Push¶
Never push untested images:
docker build -t policy-platform:test .
docker run policy-platform:test kyverno version
docker push policy-platform:test # Only after tests pass
5. Document Tool Versions¶
Maintain VERSIONS.md:
# Tool Versions
- Kyverno CLI: v1.13.2
- Pluto: v5.21.1
- Spectral: latest
- Helm: Alpine package (3.14.x)
- yq: Alpine package (4.x)
Included Tools¶
Kyverno CLI¶
Version: v1.13.2
Usage:
Pluto¶
Version: v5.21.1
Usage:
Spectral¶
Version: Latest (dynamically fetched)
Usage:
Helm¶
Version: Alpine package (3.14.x)
Usage:
yq¶
Version: Alpine package (4.x)
Usage:
Policy Sources¶
This container aggregates policies from:
- security-policy: Security and compliance policies
- devops-policy: Operational best practices
- backend-applications: Application schemas and templates
For details, see Multi-Source Policies.
Next Steps¶
- Local Development - Use policy-platform locally
- CI Integration - Automated pipeline validation
- Operations - Day-to-day management