Tech

Apple releases container machine tool for Linux environments on macOS

The 'container machine' tool, hosted in the apple/container GitHub repository, allows developers to run standard OCI images with seamless host integration and systemd support.

Author
Owen Mercer
Markets and Finance Editor
Published
Draft
Source: Hacker News · original
Tech
No image available
New open-source Swift utility enables persistent, lightweight Linux virtual machines on Apple silicon

Apple has published documentation for a new open-source utility designed to create and run Linux containers using lightweight virtual machines on macOS. The tool, known as 'container machine', is written in Swift and optimised for Apple silicon processors. It is available in the apple/container repository on GitHub, offering developers a method to deploy persistent, fast Linux environments that operate alongside the host operating system.

Unlike traditional containers that are typically modelled around single applications, this utility is designed to emulate a full Linux environment. It runs the image’s init system, such as systemd, which allows users to register long-running services or test applications under a process supervisor. This architecture supports standard Open Container Initiative (OCI) images that can be built and shared, providing a highly integrated development experience.

The system features automatic mapping of the host username and home directory into the Linux environment. This integration ensures that repositories and dotfiles are accessible on both platforms, enabling seamless access to Linux environments from macOS terminals. Users can utilise macOS editors and tools simultaneously while building and running applications inside the Linux container, maintaining a unified workflow.

Configuration is managed via the command line, with the tool offering aliases such as 'm' for 'container machine'. Commands like 'm ls' and 'm run' allow for quick interaction, while 'container machine set' updates configuration settings on disk. Default memory allocation is set to half of the host memory, and home mount permissions can be adjusted to read-write, read-only, or none. Changes to these settings take effect after the next stop and start cycle.

The tool supports custom provisioning scripts at /etc/machine/create-user.sh for first-boot setup, running once as root. Apple provided an example of building an Ubuntu 24.04 container machine image with systemd and common command-line tools, demonstrating compatibility with Linux images that include /sbin/init. The documentation notes that any compatible Linux image can function as a container machine, facilitating flexible deployment scenarios.

Continue reading

More from Tech

Read next: Google slashes US AI subscription price to $4.99, igniting price war
Read next: Apple’s iOS 27 beta introduces functional Siri AI built on Google’s Gemini
Read next: Sabertooth VC deploys $400m in AI and deep tech via SPV model