Quick Start β’ Documentation β’ Examples β’ Contributing
Kimia is a Kubernetes-native, OCI-compliant container image builder designed for secure, daemonless builds in cloud environments.
Built on proven container technologies, Kimia provides enhanced security through rootless operation and user namespace isolation.
π Security First
- Rootless by Design - Runs as non-root user (UID 1000)
- User Namespace Isolation - Complete separation from host system
- Minimal Capabilities - Only SETUID & SETGID required
- No Privileged Mode - Works without elevated permissions
- Image Signing & Attestations - Built-in Cosign integration with SBOM & Provenance
βοΈ Cloud Native
- Kubernetes Native - Designed for K8s from the ground up
- GitOps Ready - Works with ArgoCD, Flux, Tekton, Jenkins
- Multi-Platform - Supports AWS EKS, GCP GKE, Azure AKS, OpenShift
- OCI Compliant - Standards-based image building
π Developer Friendly
- Kaniko Argument Compatible - Familiar command-line interface
- Git Integration - Build directly from repositories
- Layer Caching - Fast, efficient rebuilds
- Standard Dockerfiles - No special syntax required
Below is a table comparing Kimia and Kaniko for Kubernetes-native container image building. For a deeper comparison, review the dedicated comparison page.
| Feature | Kimia | Kaniko | Advantage |
|---|---|---|---|
| User Context | Non-root (UID 1000) | Root (UID 0) | β Kimia: Reduced privilege escalation risk |
| Capabilities Required | SETUID, SETGID only | None | βοΈ Kimia: Explicit minimal caps for user namespaces |
| Docker Daemon | Not required | Not required | β Equal: No daemon dependencies |
| Privileged Mode | Not required | Not required | β Equal: No privileged containers |
| User Namespaces | Required & utilized | Not used | β Kimia: Additional isolation layer |
| Complex Dockerfiles | Full support | Limited (chown issues) | β Kimia: Better compatibility with ownership changes |
| Storage Driver | VFS/Overlay (configurable) | Various | β Kimia: Configurable, consistent |
| Build Cache | Layer + registry/inline/local/S3 caching | Layer caching only | β Kimia: Advanced distributed caching |
| Registry Authentication | Multiple methods | Multiple methods | β Equal: Flexible auth options |
| Multi-stage Builds | Full support | Full support | β Equal: Modern Dockerfile features |
| Git Integration | Built-in (via args) | Built-in (via executor) | β Equal: Both support Git directly |
| Attack Surface | Minimal (rootless) | Larger (root) | β Kimia: Significantly reduced |
| Pod Security Standards | Restricted-compliant* | Baseline only | β Kimia: Higher security standard |
| Build Performance | Fast (native) | Fast (native) | β Equal: Both performant |
| Cross-platform Builds | β Supported | β Supported | β Equal: Multi-arch capable |
| Secrets Handling | Buildah secrets | Kaniko secrets | β Equal: Secure secret management |
| Resource Efficiency | Lightweight | Lightweight | β Equal: Minimal overhead |
| Reproducible Builds | β Built-in | Manual setup | β Kimia: Native support |
*With allowPrivilegeEscalation: true for user namespace operations
- Build Isolation & Security Guide - Comprehensive security practices
- CLI Reference - Complete command-line documentation
- Attestation & Signing - SBOM, Provenance, and Cosign integration
- Installation - Platform-specific setup
- Examples - Common use cases and patterns
- Reproducible Builds - Supply chain security
- Performance Optimization - Caching and tuning
- Troubleshooting - Common issues and solutions
- Comparison with Kaniko - Feature comparison
- GitOps Integration - ArgoCD, Flux, Tekton, Jenkins
- FAQ - Frequently asked questions
Kimia uses Linux user namespaces to provide true rootless operation:
Host System (Real) User Namespace (Mapped)
βββββββββββββββββ βββββββββββββββββββββββ
UID 1000 (kimia) ββββΊ UID 0 (appears as root)
UID 100000 ββββΊ UID 1
UID 100001 ββββΊ UID 2
... ...
UID 165535 ββββΊ UID 65535
Even if a container escapes, it only has unprivileged user access on the host.
Kimia is available in two variants, both providing the same security guarantees:
| Variant | Base Technology | Image Name | Best For |
|---|---|---|---|
| Kimia | BuildKit | ghcr.io/rapidfort/kimia |
Maximum compatibility, Moby ecosystems |
| Kimia-Bud | Buildah | ghcr.io/rapidfort/kimia-bud |
Light, Buildah ecosystem |
Both variants:
- Support the same Kimia command-line arguments
- Provide identical security properties
- Are fully OCI-compliant
- Support multi-architecture builds
- Reproducible builds
- Kubernetes 1.21+
- User namespaces enabled on nodes
- Container registry credentials
Enable user namespaces on your nodes:
# Check if enabled
cat /proc/sys/user/max_user_namespaces
# Enable if needed (value should be > 0)
sudo sysctl -w user.max_user_namespaces=15000
# Make persistent
echo "user.max_user_namespaces=15000" | sudo tee -a /etc/sysctl.confCreate a Kubernetes Job to build and push an image:
apiVersion: batch/v1
kind: Job
metadata:
name: kimia-build
spec:
ttlSecondsAfterFinished: 3600
template:
spec:
restartPolicy: Never
securityContext:
runAsNonRoot: true
runAsUser: 1000
fsGroup: 1000
containers:
- name: kimia
image: ghcr.io/rapidfort/kimia
args:
- --context=https://github.com/nginx/docker-nginx.git
- --dockerfile=mainline/alpine/Dockerfile
- --destination=myregistry.io/nginx:latest
- --no-push
securityContext:
allowPrivilegeEscalation: true
capabilities:
drop: [ALL]
add: [SETUID, SETGID]
appArmorProfile:
type: Unconfined
seccompProfile:
type: Unconfined# From existing Docker config
kubectl create secret generic registry-credentials \
--from-file=.dockerconfigjson=$HOME/.docker/config.json \
--type=kubernetes.io/dockerconfigjson
# Or create manually
kubectl create secret docker-registry registry-credentials \
--docker-server=myregistry.io \
--docker-username=myuser \
--docker-password=mypassword# Deploy the build job
kubectl apply -f kimia-build.yaml
# Watch job status
kubectl get jobs -w
# View build logs
kubectl logs job/kimia-build -fKimia supports a comprehensive set of command-line arguments. Key options include:
| Argument | Description | Example |
|---|---|---|
-c, --context |
Build context (directory or Git URL) | --context=. |
-f, --dockerfile |
Path to Dockerfile | --dockerfile=Dockerfile |
-d, --destination |
Target image (repeatable) | --destination=myapp:latest |
-t, --target |
Multi-stage build target | --target=builder |
--context-sub-path |
Subdirectory within context | --context-sub-path=app |
| Argument | Description | Default |
|---|---|---|
--build-arg |
Build-time variables (repeatable) | - |
--cache |
Enable layer caching | false |
--cache-dir |
Custom cache directory | - |
--export-cache |
Export build cache (BuildKit, repeatable) | type=registry,ref=... |
--import-cache |
Import build cache (BuildKit, repeatable) | type=registry,ref=... |
--storage-driver |
Storage backend (native|overlay) | native |
--label |
Image labels (repeatable) | - |
| Argument | Description |
|---|---|
--no-push |
Build without pushing to registry |
--tar-path |
Export image to TAR file |
--digest-file |
Write image digest to file |
--image-name-with-digest-file |
Write full image reference |
| Argument | Description | Example |
|---|---|---|
--attestation |
Simple mode (off|min|max) | --attestation=min |
--attest |
Docker-style attestations | --attest type=sbom |
--sign |
Sign image with Cosign | --sign |
--cosign-key |
Cosign private key path | --cosign-key=/keys/key |
| Argument | Description |
|---|---|
--git-branch |
Git branch to checkout |
--git-revision |
Git commit SHA |
--git-token-file |
Git token for private repos |
--git-token-user |
Git token username |
| Argument | Description |
|---|---|
--insecure |
Allow insecure connections |
--insecure-pull |
Allow insecure base image pulls |
--insecure-registry |
Skip TLS for specific registry |
--push-retry |
Number of push retry attempts |
--image-download-retry |
Number of image download retries |
--registry-certificate |
Custom registry certificate |
| Argument | Description | Example |
|---|---|---|
--reproducible |
Enable reproducible builds | --reproducible |
--timestamp |
Set build timestamp (Unix epoch) | --timestamp=1609459200 |
Note:
--timestampautomatically enables--reproducible. SupportsSOURCE_DATE_EPOCHenv var.
| Argument | Description | Default |
|---|---|---|
-v, --verbosity |
Log level (debug|info|warn|error) | info |
--log-timestamp |
Add timestamps to logs | false |
| Argument | Description |
|---|---|
--buildkit-opt |
Pass options directly to BuildKit |
Full reference: See CLI Reference for complete documentation.
Kaniko users: Kimia supports most Kaniko arguments - see Comparison Guide for details.
Kimia supports two storage drivers:
| Driver | Description | Best For | Requirements |
|---|---|---|---|
| native (default) | VFS-based storage | Maximum compatibility, TAR exports | None |
| overlay | OverlayFS-based | Performance, production builds | Kernel support |
# Use overlay driver for better performance
kimia --context=. --destination=myapp:latest --storage-driver=overlay
# Use native for TAR exports
kimia --context=. --tar-path=/output/image.tar --storage-driver=native --no-pushKimia provides defense-in-depth security through multiple layers:
β Rootless Operation
- Runs as non-root user (UID 1000)
- No root privileges required on host
β User Namespace Isolation
- Container UID 0 β Host UID 1000 (unprivileged)
- Additional security boundary
β Minimal Capabilities
- Only SETUID & SETGID capabilities required
- All other capabilities dropped
β No Privileged Mode
- Works without
privileged: true - Compliant with Pod Security Standards (Restricted*)
β Daemonless
- No Docker/Podman daemon required
- Reduced attack surface
*Requires allowPrivilegeEscalation: true for user namespace operations
securityContext:
# Pod-level security
runAsNonRoot: true
runAsUser: 1000
fsGroup: 1000
seccompProfile:
type: RuntimeDefault
containers:
- name: kimia
securityContext:
# Container-level security
runAsUser: 1000
allowPrivilegeEscalation: true # Required for user namespaces
capabilities:
drop: [ALL]
add: [SETUID, SETGID] # Minimal capabilities
seccompProfile:
type: RuntimeDefaultDetailed security documentation: Security Guide
Kimia supports reproducible builds for supply chain security and compliance.
Reproducible builds require collaboration between your build configuration and Kimia:
Your Responsibility:
- π Pin base image digests (e.g.,
FROM alpine@sha256:...) - π Pin package versions in Dockerfile
- π Use fixed versions for external dependencies
Kimia's Responsibility:
- π§ Normalize file timestamps
- π§ Sort build arguments and labels
- π§ Use deterministic metadata
- π§ Disable caching (optional but recommended)
# Reproducible build with epoch 0 (default)
kimia --context=. --destination=myapp:v1 --reproducible
# Reproducible build with custom timestamp
kimia --context=. --destination=myapp:v1 --timestamp=1609459200
# Use git commit timestamp for versioning
export SOURCE_DATE_EPOCH=$(git log -1 --format=%ct)
kimia --context=. --destination=myapp:v1 --reproducibleComplete guide: Reproducible Builds Documentation
Kimia supports advanced BuildKit caching strategies to significantly speed up builds by reusing previously built layers.
| Backend | Description | Best For |
|---|---|---|
| registry | Store cache in an OCI registry | CI/CD pipelines, distributed teams |
| inline | Embed cache metadata in the built image | Simple setups, no extra storage |
| local | Cache to a local/mounted directory | CI runners with shared volumes |
| s3 | Cache to an S3-compatible bucket | Cloud-native workflows |
| gha | GitHub Actions cache | GitHub CI |
# Registry cache (recommended for CI/CD)
kimia --context=. --destination=registry.io/myapp:v1 \
--cache \
--import-cache type=registry,ref=registry.io/cache/myapp:latest \
--export-cache type=registry,ref=registry.io/cache/myapp:latest,mode=max
# Inline cache (simplest β no extra storage needed)
kimia --context=. --destination=registry.io/myapp:v1 \
--cache \
--export-cache type=inline
# Local cache (for CI runners with persistent volumes)
kimia --context=. --destination=registry.io/myapp:v1 \
--cache \
--import-cache type=local,src=/mnt/cache \
--export-cache type=local,dest=/mnt/cache,mode=maxapiVersion: batch/v1
kind: Job
metadata:
name: kimia-build-cached
spec:
template:
spec:
restartPolicy: Never
containers:
- name: kimia
image: ghcr.io/rapidfort/kimia:latest
args:
- --context=https://github.com/myorg/myapp.git
- --destination=registry.io/myapp:v1
- --cache
- --import-cache
- type=registry,ref=registry.io/cache/myapp:latest
- --export-cache
- type=registry,ref=registry.io/cache/myapp:latest,mode=max
securityContext:
allowPrivilegeEscalation: true
capabilities:
drop: [ALL]
add: [SETUID, SETGID]Note:
--export-cacheand--import-cacheare repeatable and BuildKit-only. Cache flags are automatically ignored when--reproducibleis set.
Kimia provides built-in support for generating attestations and signing container images with Cosign, enabling supply chain security and compliance.
β SBOM (Software Bill of Materials)
- Complete inventory of packages and dependencies
- SPDX 2.3 format
- Vulnerability scanning support
β Provenance (Build Information)
- SLSA compliance
- Verifiable build metadata
- Complete audit trail
β Image Signing
- Sigstore Cosign integration
- Cryptographic verification
- Manifest list signing
apiVersion: batch/v1
kind: Job
metadata:
name: kimia-build-signed
spec:
template:
spec:
restartPolicy: Never
containers:
- name: kimia
image: ghcr.io/rapidfort/kimia:latest
args:
- --context=https://github.com/myorg/myapp.git
- --destination=registry.io/myapp:v1
- --attestation=max # Generate SBOM + Provenance
- --sign # Sign with Cosign
- --cosign-key=/secrets/cosign.key
- --cosign-password-env=COSIGN_PASSWORD
env:
- name: COSIGN_PASSWORD
valueFrom:
secretKeyRef:
name: cosign-keys
key: password
volumeMounts:
- name: cosign-key
mountPath: /secrets
readOnly: true
volumes:
- name: cosign-key
secret:
secretName: cosign-keys# Verify image signature
cosign verify --key cosign.pub registry.io/myapp:v1
# Inspect attestations
crane manifest registry.io/myapp:v1 | jq .Complete guide: Attestation & Signing Documentation
- AWS EKS - Works out of the box on standard EKS
- Google GKE - User namespaces enabled by default
- Azure AKS - Enable via nodepool configuration
- Red Hat OpenShift - Available on OpenShift 4.7+
Full installation guide: Installation Documentation
We welcome contributions! Please see our Contributing Guide for details.
# Clone and build
git clone https://github.com/rapidfort/kimia.git
cd kimia
make build
# Run tests
make testKimia is licensed under the MIT License.
- π GitHub Issues - Bug reports and feature requests
- π¬ Discussions - Questions and community support
- π§ Email: support@rapidfort.com
- Built on Buildah - A tool that facilitates building OCI images.
- Built on Buildkit - concurrent, cache-efficient, and Dockerfile-agnostic builder toolkit
- Inspired by Kaniko - Pioneering daemonless builds
- Container tools from the Containers organization