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

When USE_DHI=false (default), migetpacks generates containers with the following configuration:

Container Structure

User Configuration

The miget user is created in the runtime image:

Port Configuration

The default exposed port is 5000. Override it with the PORT environment variable:
The PORT environment variable is set in the generated Dockerfile, so the application can read it at runtime.

DHI Runtime (Distroless)

When USE_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:
  1. No shell commands — Commands cannot use /bin/sh -c wrappers
  2. Exec format only — Process commands must use exec format
  3. No shebangs — Scripts like ./bin/rails must be invoked as ruby bin/rails
  4. No variable expansion — Shell variables like ${PORT:-5000} must be pre-expanded
  5. 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. The KNOWN_BUILDER_VARS filter ensures sensitive variables (like AWS_ACCESS_KEY_ID) are excluded from the generated Dockerfile.