Overview
migetpacks produces optimized runtime containers that run as non-root users by default. The container configuration depends on whether you are using standard images or Docker Hardened Images (DHI).Standard Runtime
WhenUSE_DHI=false (default), migetpacks generates containers with the following configuration:
Container Structure
User Configuration
Themiget user is created in the runtime image:
Port Configuration
The default exposed port is5000. Override it with the PORT environment variable:
PORT environment variable is set in the generated Dockerfile, so the application can read it at runtime.
DHI Runtime (Distroless)
WhenUSE_DHI=true, migetpacks uses Docker Hardened Images from dhi.io. These are distroless containers with a minimal attack surface.
Distroless Constraints
DHI runtime images have no shell, no package manager, and no common utilities. This means:- No shell commands — Commands cannot use
/bin/sh -cwrappers - Exec format only — Process commands must use exec format
- No shebangs — Scripts like
./bin/railsmust be invoked asruby bin/rails - No variable expansion — Shell variables like
${PORT:-5000}must be pre-expanded - No debugging tools — No
ls,cat,curl, etc. in production
Command Transformation
migetpacks automatically transforms commands for distroless:Result JSON Indicator
When DHI is used, the result JSON includes"_shell": false to signal that the container is distroless. Deployment systems should use this flag to determine how to execute commands in the container.
Runtime Cleanup
migetpacks automatically removes unnecessary files from runtime images to reduce size and attack surface.Node.js
Ruby
Python
.NET
.NET is a compiled language, so source code is completely removed from the runtime image. Node.js, Ruby, and Python are interpreted languages, so source code is kept but development/test files are removed.
Inspecting Built Containers
List Files
Check Environment
Check User
Check Exposed Ports
Check Entrypoint/CMD
Layer History
Image Size
Security
Non-Root by Default
All migetpacks containers run as a non-root user. This provides:- Process isolation from the host
- Prevention of privilege escalation
- Compliance with Kubernetes Pod Security Standards (restricted profile)
Read-Only Filesystem
For maximum security, run the container with a read-only root filesystem:No Credentials in Image
migetpacks never includes AWS credentials or other secrets in the built image. TheKNOWN_BUILDER_VARS filter ensures sensitive variables (like AWS_ACCESS_KEY_ID) are excluded from the generated Dockerfile.