Skip to content

feat: add Apple container runtime support#211

Open
OVELYB wants to merge 4 commits into
pranshuparmar:stagingfrom
OVELYB:feat/add-apple-container-support
Open

feat: add Apple container runtime support#211
OVELYB wants to merge 4 commits into
pranshuparmar:stagingfrom
OVELYB:feat/add-apple-container-support

Conversation

@OVELYB

@OVELYB OVELYB commented Jul 14, 2026

Copy link
Copy Markdown

Description

Add support for Apple's container CLI tool as a container runtime backend. The container tool (github.com/apple/container) runs Linux containers as lightweight VMs on macOS using the Virtualization framework, and is becoming increasingly popular as a Docker Desktop alternative on Apple Silicon Macs.

This PR:

  • Adds runtime_container_apple.go implementing the ContainerRuntime interface for Apple container
  • Parses container ls --format json --all output to list containers with full metadata (image, state, networks, mounts, ports, command)
  • Implements Enrich() via container inspect to get accurate container start times
  • Adds Apple container detection in container_detect.go for process-level container identification
  • HostPID() returns 0 since VM-based containers have no direct host PID mapping

Note: container is macOS-only (uses the macOS Virtualization framework). The implementation is safe on Linux — Available() returns false when the binary is absent.

Type of change

Check all that apply:

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (may affect existing functionality)
  • This change requires a documentation update

Checklist

  • I have formatted my code using go fmt ./...
  • I have opened this PR against the staging branch
  • I have performed a self-review of my own code
  • I have added helpful comments where needed
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • New and existing unit tests pass locally with my changes

Test Plan

Environment: macOS 26 (Apple Silicon) with container installed via Homebrew.

Steps:

  1. container system start — start the container daemon
  2. container run -d --name test-nginx nginx:latest — start a test container
  3. go run ./cmd/witr -i — launch witr TUI
  4. Switch to the Containers tab — verify the container appears with correct ID, image, state, ports, and command
  5. Select the container row — verify the detail pane shows full container metadata

Additional verification:

  • go build ./... — compiles without errors on macOS
  • go vet ./... — no warnings
  • go test ./... — all existing tests pass (no regressions)
  • Verified on Linux: runtime_container_apple.go compiles cleanly, Available() returns false since container binary doesn't exist on Linux

Screenshots

image

pranshuparmar and others added 4 commits June 24, 2026 12:10
Add Apple container runtime detection on macOS, including runtime_container_apple.go implementation and corresponding tests in container_detect_test.go and runtime_container_test.go.
@pranshuparmar
pranshuparmar changed the base branch from main to staging July 14, 2026 09:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants