Overview
Docker Hardened Images (DHI) fromdhi.io provide secure, CVE-free base images with minimal attack surfaces. When enabled, migetpacks uses DHI images for both the build stage (-dev variants with shell) and the runtime stage (distroless, no shell).
Enabling DHI
SetUSE_DHI=true to enable Docker Hardened Images:
Registry Authentication
Thedhi.io registry requires authentication. How you provide credentials depends on your environment.
CI/CD Environments (GitHub Actions, GitLab CI)
In CI/CD pipelines, credentials are typically available via secrets. The easiest approach is to pass them as environment variables:Local Development (Docker Desktop)
Docker Desktop on Mac and Windows stores credentials in the system keychain (credsStore: desktop), not in ~/.docker/config.json. When you run docker login dhi.io, the credentials are stored in the keychain, but the migetpacks container cannot access them.
Extract the credentials from the keychain and pass them as environment variables:
Linux
On Linux, credentials are typically stored directly in~/.docker/config.json after running docker login dhi.io. Mount this file:
pass or secretservice), extract credentials and pass them as environment variables:
Kubernetes/Shipwright
When running migetpacks in Kubernetes via Shipwright, use animagePullSecret containing your DHI credentials:
Image Variants
- Build Images (-dev)
- Runtime Images (distroless)
The
-dev variants include:- Shell (
/bin/sh) - Package manager (
apt-get) - Build tools (compilers, headers)
Supported Languages
| Language | Build Image | Runtime Image | Notes |
|---|---|---|---|
| Node.js | dhi.io/node:{version}-dev | dhi.io/node:{version} | Distroless runtime |
| Deno | dhi.io/deno:{version}-dev | dhi.io/deno:{version} | Requires 2.6.4+ |
| Bun | dhi.io/bun:{version}-dev | dhi.io/bun:{version} | Requires 1.3.6+ |
| Ruby | dhi.io/ruby:{version}-dev | dhi.io/ruby:{version} | Libraries copied from builder |
| Python | dhi.io/python:{version}-dev | dhi.io/python:{version} | Distroless runtime |
| Go | dhi.io/golang:{version}-dev | dhi.io/golang:{version} | Requires 1.22+ |
| Rust | dhi.io/rust:{version}-dev | dhi.io/rust:{version} | Distroless runtime |
| Java | dhi.io/eclipse-temurin:{version}-jdk-dev | dhi.io/eclipse-temurin:{version} | Maven/Gradle installed in builder |
| Kotlin | dhi.io/eclipse-temurin:{version}-jdk-dev | dhi.io/eclipse-temurin:{version} | Reads system.properties |
| Scala | sbtscala/scala-sbt:... (official) | dhi.io/eclipse-temurin:{java} | Official build, DHI runtime |
| Clojure | clojure:temurin-{java}-lein (official) | dhi.io/eclipse-temurin:{java} | Official build, DHI runtime |
| .NET | dhi.io/dotnet:{version}-sdk | dhi.io/aspnetcore:{version} | Distroless runtime |
DHI Mirror
If you have a private mirror for DHI images (e.g., behind a firewall), useDHI_MIRROR:
Deployment Considerations
Distroless containers have important behavioral differences from traditional containers.No Shell Available
Commands cannot use shell features like pipes, variable expansion, or shebangs:Shell variables like
${PORT:-5000} must be pre-expanded to literal values. migetpacks handles this automatically during Dockerfile generation.Ruby-Specific Considerations
Ruby scripts with shebangs (#!/usr/bin/env ruby) do not work in distroless containers:
- Process commands are transformed:
./bin/railsbecomesruby bin/rails BUNDLER_VERSIONis set fromGemfile.lockto prevent bundler auto-switching (which requires/usr/bin/env)- Native gem shared libraries (
.sofiles) are copied from the builder stage - PATH includes
/app/bin:/app/vendor/bundle/bin
Java-Specific Considerations
- Eclipse Temurin JDK images do not include Maven or Gradle
- Build tools are installed via
apt-getin the builder stage - Runtime uses distroless JRE (no JDK)
- Version normalization applies:
1.8becomes8,1.11becomes11
Go Version Requirements
Go DHI images require version 1.22 or newer, with minimum patch versions:- Go 1.22.12+
- Go 1.23.7+
- Go 1.24.1+
Result JSON
When using DHI, the build result JSON includes_shell: false to signal that the container is distroless: