Commit Graph
33 Commits
Author SHA1 Message Date
Michael Crosby b438e97b93 Add cloud-hypervisor VMM backend for Linux hosts (#782)
apple/containerization currently runs containers in per-container VMs on
macOS hosts via Virtualization.framework. This adds a second VMM backend
so the same Swift orchestration layer (LinuxContainer / LinuxPod /
Vminitd gRPC contract) runs on Linux hosts via cloud-hypervisor + KVM.

**CloudHypervisor Swift package** (`Sources/CloudHypervisor/`) — a thin
client for cloud-hypervisor's REST-over-UDS API, layered on
AsyncHTTPClient. Endpoints cover VMM / VM lifecycle / hotplug (disk, fs,
net, vsock, remove-device). Cross-platform (compiles on macOS for unit
tests; consumed at runtime only by the Linux side of Containerization).

**CH backend in Containerization** — one cloud-hypervisor subprocess per
VM, gated behind `#if os(Linux)`. CHVirtualMachineManager /
CHVirtualMachineInstance mirror the VZ shape behind the existing
VirtualMachineManager / VirtualMachineInstance protocol. CHProcess and
VirtiofsdProcess manage the binaries; CHHotplugProvider handles
virtio-blk and virtio-fs runtime hotplug (with one virtiofsd per unique
source-hash tag, refcounted across containers).

**Linux host networking** — BridgeManager brings up a Linux bridge with
an IPv4 subnet and (opt-in via `--enable-nat`) iptables MASQUERADE +
scoped FORWARD rules. LinuxBridgedNetwork enslaves a fresh TAP per
container to the bridge. State is recorded under `/run/containerization`
so `cctl bridge delete` reverses exactly what create did. Bridge
teardown verifies the link kind via sysfs to refuse deleting non-bridge
interfaces.

**cctl run / bridge** — end-to-end Linux container run path (image pull,
ext4 rootfs assembly, VM boot, container exec) plus `cctl bridge
create|delete` for the host network plumbing.

**Build & dist** — `make linux-build` / `make linux-integration` build
and exercise the host side inside an apple/container `--virtualization`
dev container. `make dist-x86_64` produces a deployment tarball (cctl +
cloud-hypervisor + virtiofsd + initfs + kernel) cross-compiled from the
aarch64 dev container; pipeline documented in `docs/x86_64-build.md`.
Static-musl C deps and the Zig cross compiler are pinned by SHA256.

The host orchestrator runs as root. Per-VM runtime state lives under
`/run/containerization/ch/<UUID>` with mode 0700; UDS sockets inside are
bound with mode 0600. Vminitd's gRPC channel inherits that trust
boundary — socket-file perms are the auth.

Sandbox flags are upstream-secure by default. Two per-component opt-outs
exist for the apple/container dev-container case (where the host seccomp
profile SIGSYS-kills CH and virtiofsd):
- `CONTAINERIZATION_NO_CH_SECCOMP=1` — `cloud-hypervisor --seccomp
false`.
- `CONTAINERIZATION_NO_VIRTIOFSD_SANDBOX=1` — `virtiofsd --sandbox
none`. Each emits a one-shot `logger.warning` at process start. Legacy
alias `CONTAINERIZATION_RELAXED_SANDBOX=1` flips both. cctl spawns both
binaries with `setsid` and a minimal env allowlist (PATH / HOME /
RUST_LOG / RUST_BACKTRACE) so the parent's secrets don't leak to
children.

`make linux-integration` runs the cross-platform integration suite
against a real cloud-hypervisor VM inside the dev container. Linux runs
the cross-platform subset (`process true`/`false`/`echo hi`, virtiofs
round-trip, hotplug); the macOS suite is unchanged.

Signed-off-by: michael_crosby <michael_crosby@apple.com>
2026-07-02 11:20:22 -04:00
Danny Canter 54b91c4e6f README: Add logo (#598)
We had the logo in the repo preview, but not in our readme.
2026-03-24 10:17:00 -07:00
splint-disk-8i d1b5bdb166 Fix misleading echo in swift-fmt-check target (#585)
Small documentation and Makefile fixes:

- Makefile: swift-fmt-check echo says "Applying" but the target only
checks/lints — changed to "Checking code formatting compliance"
- README.md: "libraries surface" → "libraries' API surface"
- README.md: "light weight" → "lightweight" (consistent with rest of
doc)
- README.md: "for use a default" → missing comma, grammar fix
- CONTRIBUTING.md: "To clarify of what" → "To clarify what"
2026-03-23 12:05:57 -07:00
J Logan dadfdcefae Adds opt-in precommit hook to check formatting. (#483) 2026-01-21 11:34:16 -08:00
Danny Canter 0e8a779f03 README: Adjust required version numbers (#432)
macOS and Xcode 26 are both released now, no need to still list beta.
2025-12-01 11:15:39 -05:00
Danny Canter 28892cfa11 Kernel: Fix make (#301)
Fixes #296

Today the kernel subdirectory is somewhat useless. The dockerfile we had
tried to use an image that isn't actually on ghcr, so everything would
kind of just crap out. This change swaps things so that we build a local
image that has all the bits needed to compile the kernel, and then uses
that image to build the resulting kernel and plop it in the current
working directory. This change does add a reliance on `container` being
installed however, but for folks that need to build a custom kernel this
doesn't seem like too much of an issue to me.
2025-09-30 18:48:20 -07:00
Michael Crosby e08b0d4fb4 add kernel support section to readme (#267)
closes #224

Signed-off-by: crosbymichael <michael_crosby@apple.com>
2025-08-14 15:15:43 -07:00
Tim Sneath 5a1975a3bf Clarify macOS version support and minor style tweaks (#263)
Clarify that container is only supported on macOS 26, and remove
language that implies that it's also designed for macOS 15.

This change also includes a couple of minor textual changes to improve
readability.
2025-08-11 13:35:38 -07:00
Luis David Garcia 885db858a5 Updated documentation link in README (#161)
## Description of Change

- I updated the documentation link in the README: [Documentation
Tab](https://github.com/apple/containerization?tab=readme-ov-file#documentation)
- The original link (`open http://localhost:8000/documentation/`) was
returning a **404 error**, as shown in the screenshot below.
- I fixed the issue by updating the link to: `open
http://127.0.0.1:8000/containerization/documentation/`, which works
correctly.

## Screenshot of the 404 Error and the Fix

Here’s the screenshot showing the error and the fix:

![404 Error Shown and 200
Fix](https://github.com/user-attachments/assets/4198d381-80de-4bca-a9f4-5455eee887f6)
2025-06-27 15:14:33 -04:00
Dmitry Kovba f2a2bd7fa5 Add a link to the container repository (#157)
This PR adds a link to the container repository on top of the
`README.md`:

<img width="877" alt="Screenshot 2025-06-20 at 7 54 46 PM"
src="https://github.com/user-attachments/assets/3aff3c13-b0ed-4bf6-b2c8-bb4e8ad64355"
/>
2025-06-24 12:48:28 -07:00
Cornelius Roemer cad00de874 Fix typo in README (#54) 2025-06-18 17:31:58 -07:00
Riya Amemiya 4a482a00c0 Fix typos in README and LinuxContainer.swift comments (#144)
## Changes 

### README.md

- Fixed grammatical error: "when a process is ran" → "when a process is
run"
- Fixed plural form: "for instruction on" → "for instructions on"

### kernel/README.md

- Fixed numbering sequence: "4. Run `make`" → "3. Run `make`" in build
instructions

### Sources/Containerization/LinuxContainer.swift

- Fixed grammatical error in comment: "The container has ran" → "The
container has run"
2025-06-17 02:40:05 -07:00
Dmitry Kovba a65deb517a Add instructions for installing Xcode (#125)
Now, we require installing Xcode 26 beta. This PRs adds an important
step of setting the active developer directory. Fixes
https://github.com/apple/containerization/issues/119.
2025-06-16 09:23:34 -07:00
ronbo 1ee7d10cca Add swiftly link (#95)
add link to swiftly toolchain manager
2025-06-11 10:32:40 -07:00
Dmitry Kovba bc1032e218 Require having Xcode 26 beta (#84)
This PR requires installing Xcode 26 beta until we resolve
https://github.com/apple/containerization/issues/66.
2025-06-11 10:43:52 -04:00
Spencer King 6d18db68ff docs: Avoid using Latin abbreviations in documentation (#81)
Remove Latin abbreviations from the documentation in accordance with the
[Apple Style Guide](https://help.apple.com/applestyleguide/). This
change does not impact any abbreviations used in code comments since
those are not covered by the style guide.
2025-06-10 21:36:18 -07:00
Dmitry Kovba 4ad3c996f0 Update the names of Xcode, macOS, and Apple silicon (#83)
This PR updates the names of Xcode and macOS to the official names used
in https://developer.apple.com/download/applications/. Also, it fixes
the capitalization in "Apple silicon".
2025-06-10 18:03:25 -07:00
Aviram HassanandDanny Canter 6216c6eee8 clarified linux/amd64 images support (#77)
#70 Made it clearer as I wasn't sure if the API allows us to run x64
binaries or also run such Docker images.

---------

Signed-off-by: Aviram Hassan <aviramyhassan@gmail.com>
Co-authored-by: Danny Canter <danny_canter@apple.com>
2025-06-10 15:56:18 -04:00
Danny Canter d1a8fae1af Add links in README to the various products (#73) 2025-06-10 09:48:31 -07:00
J Logan cd175a7972 Adds API link to README. (#61) 2025-06-09 17:35:36 -07:00
The Alchemist 91db40d99c Update README.md with minor correction (#50)
Not to be pedantic, but "light weight" is usually considered to be one
word.
2025-06-09 15:29:42 -07:00
Danny Canter 66e991ac05 Clarify source stability (#45) 2025-06-09 11:38:25 -07:00
J Logan 56c06be9a9 Fine-tune build requirements. (#44) 2025-06-09 10:49:37 -07:00
Madhu Venugopalandmadhu a595d0cca5 Updating latest macOS and Xcode versions (#43)
Co-authored-by: madhu <mvenugopal@apple.com>
2025-06-09 10:40:43 -07:00
Eric Ernst 8d094935af README: split prep, build and test directions into own sections (#41)
If we split this out, it'll be easier to point developers at specific
parts for setting up their build environment, versus building and
testing.

Signed-off-by: Eric Ernst <eric_ernst@apple.com>
2025-06-08 22:31:32 -07:00
Eric Ernst 3fd2c220a2 docs: update version description (#40)
Let's just be consistent and use 15 instead of Sequoia
2025-06-08 17:51:53 -07:00
Madhu Venugopal 9c1b08d3e7 Update README.md (#35)
Fixed minor typo
2025-06-07 12:13:42 -07:00
Michael Crosby 9959810656 separate fetch-default-kernel make target (#27)
Signed-off-by: michael crosby <michael_crosby@apple.com>
2025-06-06 15:05:24 -07:00
Patrice Jaton ca3c94a0b6 Update documentations. (#26)
Some updates to the documentation:

* Replace code-of-conduct with organization one.
* Cleanup `CONTRIBUTING.md`, `README.md` and `SECURITY.md` markdown.
* Remove `.txt` extension from `LICENSE` for consistency across repos.
2025-06-06 10:52:03 -07:00
Danny Canter fc4a124173 Continue documenting public surface (#25)
Signed-off-by: Danny Canter <danny_canter@apple.com>
2025-06-06 10:34:19 -04:00
Danny Canter 782e37c96f README: Reword beginning of Design section (#7)
The first intro sentences don't read very well. This just tries
to create a cohesive section describing the core design.

Signed-off-by: Danny Canter <danny_canter@apple.com>
2025-06-05 16:16:15 -07:00
Kathryn Baldauf 502dab6108 Update containerization apple main (#4)
Signed-off-by: Kathryn Baldauf <k_baldauf@apple.com>
2025-06-05 16:15:44 -07:00
+6 3407cc3f16 initial commit
Co-authored-by: Aditya Ramani <a_ramani@apple.com>
Co-authored-by: Agam Dua <agam_dua@apple.com>
Co-authored-by: Danny Canter <danny_canter@apple.com>
Co-authored-by: Dmitry Kovba <dkovba@apple.com>
Co-authored-by: Eric Ernst <eric_ernst@apple.com>
Co-authored-by: Evan Hazlett <ehazlett@apple.com>
Co-authored-by: Gilbert Song <gilbertsong@apple.com>
Co-authored-by: Hugh Bussell <hbussell@apple.com>
Co-authored-by: John Logan <john_logan@apple.com>
Co-authored-by: Kathryn Baldauf <k_baldauf@apple.com>
Co-authored-by: Madhu Venugopal <mvenugopal@apple.com>
Co-authored-by: Michael Crosby <michael_crosby@apple.com>
Co-authored-by: Sidhartha Mani <sidhartha_mani@apple.com>
Co-authored-by: Tanweer Noor <tnoor@apple.com>
Co-authored-by: Ximena Perez Diaz <xperez528@gmail.com>
Co-authored-by: Yibo Zhuang <yzhuang@apple.com>
2025-06-05 16:15:21 -07:00