Skip to main content
Version: Next

Runtime Selection Flowchart

This diagram documents the decision tree for selecting which runtime executes a command. Understanding this helps users choose the right runtime for their use case.

Decision Flowchart

Diagram: architecture/runtime-decision

Platform Selection Details

Diagram: architecture/runtime-platform

Platform Values

Platform ValueMatches On
"linux"Linux systems
"macos"macOS systems
"windows"Windows systems
note

At least one platform must be specified per implementation. There is no "all platforms" shorthand — list each target platform explicitly.

Example Command Definition

cmds: [{
name: "build"
implementations: [
{
script: "nmake build"
runtimes: [{name: "native"}]
platforms: [{name: "windows"}]
},
{
script: "make build"
runtimes: [{name: "container", image: "golang:1.26"}]
platforms: [{name: "linux"}]
},
{
script: "make build"
runtimes: [{name: "native"}]
platforms: [{name: "macos"}]
},
]
}]

Runtime Comparison

AspectNativeVirtualContainer
SpeedFastestFastSlower (overhead)
IsolationNoneNone (not a sandbox)Full
PortabilityPlatform-dependentHighHighest
Shell featuresFull host shellPOSIX subsetFull (in container)
DependenciesHost shellNoneDocker/Podman
Best forSimple scriptsCross-platformComplex environments

Runtime Resolution Precedence

Runtime mode is resolved in this order:

  1. --ivk-runtime CLI override — hard fail if incompatible with the selected implementation
  2. default_runtime from config — used only when compatible with the implementation
  3. Command default runtime — the runtime specified in the selected platform implementation
warning

There is no implicit native → virtual fallback when native is unavailable. If the native runtime is requested but cannot run (e.g., no shell found), the command fails rather than silently switching to virtual.

Runtime Availability Checks

Native Runtime

Diagram: architecture/runtime-native-check

Virtual Runtime

Diagram: architecture/runtime-virtual-check

The virtual runtime is always available because it's embedded in the Invowk binary.

Container Runtime

Diagram: architecture/runtime-container-check

Container Provisioning Details

When the container runtime is selected, Invowk creates an ephemeral image layer:

Diagram: architecture/runtime-provision

Why Ephemeral Layers?

  1. No image pollution: Base images stay clean
  2. Fast iteration: No full rebuild needed
  3. Portable: Commands work with any compatible base image
  4. Secure: Invowk binary is injected, not installed in image

SSH Server for Callbacks

When enable_host_ssh: true is set, Invowk starts a temporary SSH server:

Diagram: architecture/runtime-ssh

Use cases:

  • Accessing host secrets
  • Running host-only commands
  • File synchronization

Decision Guidelines

Use CaseRecommended RuntimeWhy
Quick scriptsnativeFastest, no overhead
Cross-platform commandsvirtualWorks everywhere
CI/CD pipelinescontainerReproducible
Commands needing specific toolscontainerIsolated dependencies
Interactive TUInative or virtualBetter terminal support