Apple has introduced a toolkit for creating, loading, and executing Linux containers on macOS. The operation of containers in macOS is facilitated by lightweight virtual machines with a Linux kernel, running via the Virtualization.framework hypervisor. Two packages are offered for working with Linux containers — containerization and container, written in Swift and open-sourced under the Apache 2.0 license.
The Containerization package provides a low-level API for managing container images in OCI format, loading containers from external repositories, creating an Ext4 root filesystem, enabling network interaction, building fast-booting Linux kernel variants, creating of virtual machines and launching individual containers within them. Containers can be linked to specific IP addresses. A framework vmnet is utilized to organize the operation of a virtual network stack tied to each container.
Launching a virtual machine takes less than a second, thanks to the use of an optimized Linux kernel configuration and a stripped-down system environment with a lightweight init process called vminitd. Interaction with the initialization process is virtual machine carried out through a GRPC API over vsock. This API allows configuring the parameters of the working environment and running containers with user-selected content or separate isolated processes on top of the virtual machine.
The Container package is an extension of the Containerization API, implementing a high-level toolkit in the style of Docker for creating, loading, starting, and stopping Linux container images in OCI format. Service management during container startup is done using the Launchd system manager.
The toolkit can be used on macOS 15, but for full functionality and to avoid potential issues, it is recommended to use macOS 26 Beta 1. For example, direct network interaction between containers is not operational on macOS 15, and binding specific IPs to containers is limited. It is possible to run on Apple Silicon Mac ARM systems (M1/M2/M3/M4), while computers based on Intel processors are not supported. For running containers built for the x86_64 architecture, the Rosetta 2 instruction set translator is used.

Source: opennet.ru
