gitmyhub

containerization

Swift ★ 8.7k updated 20h ago

Containerization is a Swift package for running Linux containers on macOS.

A Swift library from Apple that lets macOS apps run Linux containers, each isolated in its own fast-booting virtual machine on Apple silicon hardware.

SwiftmacOSOCIVirtualization frameworkRosetta 2setup: hardcomplexity 4/5

Containerization is an open-source Swift library from Apple that lets macOS applications run Linux containers. Containers are a way to package and run software in an isolated environment, similar in concept to a lightweight virtual machine but more focused on running a single application or process. Docker is the most well-known tool for containers, and this library makes that same container format work natively on a Mac.

The way it works is that each container gets its own small virtual machine, using Apple's built-in Virtualization framework that is available on Apple silicon chips. Running each container in its own virtual machine gives stronger isolation than most container systems, but the design is optimized so containers start in under a second. A custom minimal Linux kernel configuration, included in the repository, is what makes the fast boot times possible.

The library provides building blocks for working with containers programmatically: managing container images in the standard OCI format (the same format Docker uses), pulling images from registries like Docker Hub, creating the file systems containers run on, spawning the virtual machines, and launching processes inside running containers. There is also support for running Intel-based Linux containers on Apple silicon using Apple's Rosetta 2 translation layer.

This is a developer library, not a ready-made command-line tool. If you want a command-line interface for running containers on a Mac, Apple maintains a separate companion project called apple/container. The library targets macOS 26 and requires Apple silicon hardware.

The project is written entirely in Swift, is in active early development (version 0.1.0 is the first official release), and welcomes external contributions.

Where it fits