{"id":28572079,"url":"https://github.com/apple/containerization","last_synced_at":"2026-02-28T04:22:14.396Z","repository":{"id":298199623,"uuid":"992765044","full_name":"apple/containerization","owner":"apple","description":"Containerization is a Swift package for running Linux containers on macOS.","archived":false,"fork":false,"pushed_at":"2025-06-24T20:15:45.000Z","size":3849,"stargazers_count":7277,"open_issues_count":28,"forks_count":156,"subscribers_count":34,"default_branch":"main","last_synced_at":"2025-06-24T20:43:16.622Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://apple.github.io/containerization/documentation/","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/apple.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-05-29T17:15:44.000Z","updated_at":"2025-06-24T20:23:11.000Z","dependencies_parsed_at":"2025-06-24T20:39:44.559Z","dependency_job_id":null,"html_url":"https://github.com/apple/containerization","commit_stats":null,"previous_names":["apple/containerization"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/apple/containerization","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apple%2Fcontainerization","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apple%2Fcontainerization/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apple%2Fcontainerization/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apple%2Fcontainerization/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/apple","download_url":"https://codeload.github.com/apple/containerization/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apple%2Fcontainerization/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262371700,"owners_count":23300600,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-06-10T20:01:30.197Z","updated_at":"2026-02-28T04:22:14.389Z","avatar_url":"https://github.com/apple.png","language":"Swift","funding_links":[],"categories":["HarmonyOS","macOS","Swift","🤖 AI \u0026 Machine Learning"],"sub_categories":["Windows Manager"],"readme":"# Containerization\n\nThe Containerization package allows applications to use Linux containers.\nContainerization is written in [Swift](https://www.swift.org) and uses [Virtualization.framework](https://developer.apple.com/documentation/virtualization) on Apple silicon.\n\n\u003e **Looking for command line binaries for running containers?**\\\n\u003e They are available in the dedicated [apple/container](https://github.com/apple/container) repository.\n\nContainerization provides APIs to:\n\n- [Manage OCI images](./Sources/ContainerizationOCI/).\n- [Interact with remote registries](./Sources/ContainerizationOCI/Client/).\n- [Create and populate ext4 file systems](./Sources/ContainerizationEXT4/).\n- [Interact with the Netlink socket family](./Sources/ContainerizationNetlink/).\n- [Create an optimized Linux kernel for fast boot times](./kernel/).\n- [Spawn lightweight virtual machines and manage the runtime environment](./Sources/Containerization/LinuxContainer.swift).\n- [Spawn and interact with containerized processes](./Sources/Containerization/LinuxProcess.swift).\n- Use Rosetta 2 for running linux/amd64 containers on Apple silicon.\n\nPlease view the [API documentation](https://apple.github.io/containerization/documentation/) for information on the Swift packages that Containerization provides.\n\n## Design\n\nContainerization executes each Linux container inside of its own lightweight virtual machine. Clients can create dedicated IP addresses for every container to remove the need for individual port forwarding. Containers achieve sub-second start times using an optimized [Linux kernel configuration](/kernel) and a minimal root filesystem with a lightweight init system.\n\n[vminitd](/vminitd) is a small init system, which is a subproject within Containerization.\n`vminitd` is spawned as the initial process inside of the virtual machine and provides a GRPC API over vsock.\nThe API allows the runtime environment to be configured and containerized processes to be launched.\n`vminitd` provides I/O, signals, and events to the calling process when a process is run.\n\n## Requirements\n\nTo build the Containerization package, you need:\n\n- Mac with Apple silicon\n- macOS 26\n- Xcode 26\n\nOlder versions of macOS are not supported. \n\n## Example Usage\n\nFor examples of how to use some of the libraries surface, the cctl executable is a good start. This app is a useful playground for exploring the API. It contains commands that exercise some of the core functionality of the various products, such as:\n\n1. [Manipulating OCI images](./Sources/cctl/ImageCommand.swift)\n2. [Logging in to container registries](./Sources/cctl/LoginCommand.swift)\n3. [Creating root filesystem blocks](./Sources/cctl/RootfsCommand.swift)\n4. [Running simple Linux containers](./Sources/cctl/RunCommand.swift)\n\n## Linux kernel\n\nA Linux kernel is required for spawning lightweight virtual machines on macOS.\nContainerization provides an optimized kernel configuration located in the [kernel](./kernel) directory.\n\nThis directory includes a containerized build environment to easily compile a kernel for use with Containerization.\n\nThe kernel configuration is a minimal set of features to support fast start times and a light weight environment.\n\nWhile this configuration will work for the majority of workloads we understand that some will need extra features.\nTo solve this Containerization provides first class APIs to use different kernel configurations and versions on a per container basis.\nThis enables containers to be developed and validated across different kernel versions.\n\nSee the [README](/kernel/README.md) in the kernel directory for instructions on how to compile the optimized kernel.\n\n### Kernel Support\n\nContainerization allows user provided kernels but tests functionality starting with kernel version `6.14.9`.\n\n### Pre-built Kernel\n\nIf you wish to consume a pre-built kernel, make sure it has `VIRTIO` drivers compiled into the kernel (not merely as modules).\n\nThe [Kata Containers](https://github.com/kata-containers/kata-containers) project provides a Linux kernel that is optimized for containers, with all required configuration options enabled. The [releases](https://github.com/kata-containers/kata-containers/releases/) page contains downloadable artifacts, and the image itself (`vmlinux.container`) can be found in the `/opt/kata/share/kata-containers/` directory. \n\n## Prepare to build package\n\nInstall the recommended version of Xcode.\n\nSet the active developer directory to the installed Xcode (replace `\u003cPATH_TO_XCODE\u003e`):\n```bash\nsudo xcode-select -s \u003cPATH_TO_XCODE\u003e\n``` \n\nInstall [Swiftly](https://github.com/swiftlang/swiftly), [Swift](https://www.swift.org), and [Static Linux SDK](https://www.swift.org/documentation/articles/static-linux-getting-started.html):\n\n```bash\nmake cross-prep\n```\n\nIf you use a custom terminal application, you may need to move this command from `.zprofile` to `.zshrc` (replace `\u003cUSERNAME\u003e`):\n\n```bash\n# Added by swiftly\n. \"/Users/\u003cUSERNAME\u003e/.swiftly/env.sh\"\n```\n\nRestart the terminal application. Ensure this command returns `/Users/\u003cUSERNAME\u003e/.swiftly/bin/swift` (replace `\u003cUSERNAME\u003e`):\n\n```bash\nwhich swift\n```\n\nIf you've installed or used a Static Linux SDK previously, you may need to remove older SDK versions from the system (replace `\u003cSDK-ID\u003e`):\n\n```bash\nswift sdk list\nswift sdk remove \u003cSDK-ID\u003e\n```\n\n## Build the package\n\nBuild Containerization from sources:\n\n```bash\nmake all\n```\n\n## Test the package\n\nAfter building, run basic and integration tests:\n\n```bash\nmake test integration\n```\n\nA kernel is required to run integration tests.\nIf you do not have a kernel locally for use a default kernel can be fetched using the `make fetch-default-kernel` target.\n\nFetching the default kernel only needs to happen after an initial build or after a `make clean`.\n\n```bash\nmake fetch-default-kernel\nmake all test integration\n```\n\n## Protobufs\n\nContainerization depends on specific versions of `grpc-swift` and `swift-protobuf`. You can install them and re-generate RPC interfaces with:\n\n```bash\nmake protos\n```\n\n## Building a kernel\n\nIf you'd like to build your own kernel please see the instructions in the [kernel directory](./kernel/README.md).\n\n## Pre-commit hook\n\nRun `make pre-commit` to install a pre-commit hook that ensures that your changes have correct formatting and license headers when you run `git commit`.\n\n## Documentation\n\nGenerate the API documentation for local viewing with:\n\n```bash\nmake docs\nmake serve-docs\n```\n\nPreview the documentation by running in another terminal:\n\n```bash\nopen http://localhost:8000/containerization/documentation/\n```\n\n## Contributing\n\nContributions to Containerization are welcomed and encouraged. Please see [CONTRIBUTING.md](/CONTRIBUTING.md) for more information.\n\n## Project Status\n\nVersion 0.1.0 is the first official release of Containerization. Earlier versions have no source stability guarantees.\n\nBecause the Containerization library is under active development, source stability is only guaranteed within minor versions (for example, between 0.1.1 and 0.1.2). If you don't want potentially source-breaking package updates, you can specify your package dependency using .upToNextMinorVersion(from: \"0.1.0\") instead.\n\nFuture minor versions of the package may introduce changes to these rules as needed.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapple%2Fcontainerization","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fapple%2Fcontainerization","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapple%2Fcontainerization/lists"}