# Is Apple's Container Runtime Open Source? Yes, and Here's the Complete Technical Guide

> Discover if Apple's container runtime is open source. Get the complete technical guide to the apple/container repository and understand its Apache 2.0 license.

- Repository: [Apple/container](https://github.com/apple/container)
- Tags: deep-dive
- Published: 2026-07-01

---

**Yes, Apple's container runtime is fully open-source under the Apache 2.0 license.**

The `apple/container` repository hosts the complete source code for Apple's container runtime, including the `container-runtime-linux` XPC helper and the Swift implementation that powers the container CLI. Released under the permissive Apache 2.0 license, this runtime leverages the open-source [Containerization](https://github.com/apple/containerization) package to provide low-level container primitives.

## Apache 2.0 License and Public Availability

The repository includes a standard [`LICENSE`](https://github.com/apple/container/blob/main/LICENSE) file confirming Apache 2.0 distribution. This permissive license allows commercial use, modification, and redistribution of the runtime source code without proprietary restrictions. Unlike closed-source alternatives, the entire stack—from the command-line interface to the low-level runtime helper—is publicly inspectable and buildable by anyone using the Swift toolchain.

## Runtime Architecture and Open Source Implementation

The runtime component, identified as `container-runtime-linux`, is built as an **XPC helper** that the `container-apiserver` launches for each container instance. According to [[`Docs/technical-overview.md`](https://github.com/apple/container/blob/main/Docs/technical-overview.md)](https://github.com/apple/container/blob/main/docs/technical-overview.md), the implementation specifically relies on the open-source [Containerization](https://github.com/apple/containerization) package—a Swift library that provides low-level container, image, and process management capabilities.

The architecture follows a service-oriented design where the CLI communicates with the runtime through XPC routes. This separation allows the runtime to operate with elevated privileges while maintaining a secure boundary between the user-facing CLI and the container execution environment.

## Key Source Files and Directory Structure

The runtime source code is organized under `Sources/Services/RuntimeLinux` and `Sources/Services/Runtime/RuntimeClient/`:

- **[`Sources/Services/RuntimeLinux/Server/RuntimeService.swift`](https://github.com/apple/container/blob/main/Sources/Services/RuntimeLinux/Server/RuntimeService.swift)** – Implements the XPC service that manages the lifecycle of the Linux runtime helper.
- **[`Sources/Services/Runtime/RuntimeClient/RuntimeConfiguration.swift`](https://github.com/apple/container/blob/main/Sources/Services/Runtime/RuntimeClient/RuntimeConfiguration.swift)** – Handles serialization of the opaque `runtimeData` payload and reads/writes the configuration file used by the CLI.
- **[`Sources/Services/Runtime/RuntimeClient/RuntimeRoutes.swift`](https://github.com/apple/container/blob/main/Sources/Services/Runtime/RuntimeClient/RuntimeRoutes.swift)** – Defines the XPC routes (e.g., `createEndpoint`, `bootstrap`, `start`, `shutdown`) that the CLI and helpers use to communicate.
- **[`Package.swift`](https://github.com/apple/container/blob/main/Package.swift)** – Swift Package Manager manifest that declares the module's dependencies, making the project buildable by anyone.

## Building and Running the Open Source Runtime

The `container` CLI tool and its runtime can be built from source using Swift Package Manager. Once built, the system service manages the runtime lifecycle automatically.

**Command-line interaction:**

```bash

# Start the system service (launches container-apiserver and the runtime helper)

container system start

# Pull an OCI-compliant image

container pull docker.io/library/alpine:latest

# Run a container - automatically invokes container-runtime-linux

container run --rm -it alpine:latest /bin/sh

```

**Programmatic configuration in Swift:**

```swift
import RuntimeClient

// Configure custom Linux kernel and root filesystem paths
let runtimeData = LinuxRuntimeData(
    kernelPath: URL(fileURLWithPath: "/usr/local/share/container/linux/vmlinuz"),
    initialFilesystem: URL(fileURLWithPath: "/usr/local/share/container/rootfs")
)

let config = RuntimeConfiguration(
    path: URL(fileURLWithPath: "/usr/local/etc/container"),
    kernel: "/usr/local/share/container/linux/vmlinuz",
    initialFilesystem: "/usr/local/share/container/rootfs",
    containerConfiguration: .default,
    containerRootFilesystem: "/var/lib/container/rootfs",
    options: .default,
    runtimeData: try JSONEncoder().encode(runtimeData)          // opaque payload
)

// Persist the configuration – the container CLI reads this file at startup
try config.writeRuntimeConfiguration()

```

**XPC service invocation:**

```swift
import RuntimeClient

let client = RuntimeClient()

// Create a new sandbox (container) using the runtime service
let sandbox = try client.createSandbox(
    identifier: "my-sandbox",
    runtimeData: config.runtimeData!
)

// Start the sandbox
try client.start(sandbox: sandbox)

// Execute a command inside the sandbox
let output = try client.exec(
    sandbox: sandbox,
    command: ["/bin/sh", "-c", "echo Hello from the runtime!"]
)
print(String(data: output, encoding: .utf8)!)

```

## Integration with the Containerization Package

The runtime specifically depends on the open-source [Containerization](https://github.com/apple/containerization) package rather than closed-source alternatives. This Swift library provides the low-level primitives for container management, image handling, and process isolation that the `container-runtime-linux` helper utilizes. The explicit dependency on this open-source package—documented in the technical overview—demonstrates Apple's commitment to developing the runtime in the open rather than relying on proprietary black-box components.

## Summary

- **Apple's container runtime is fully open-source** under the Apache 2.0 license, hosted in the `apple/container` repository.
- The runtime is implemented in **Swift** and uses the open-source **Containerization** package for core container primitives.
- **XPC architecture** separates the CLI (`container`) from the runtime helper (`container-runtime-linux`), with source code in `Sources/Services/RuntimeLinux/`.
- **Buildable by anyone** using Swift Package Manager via the included [`Package.swift`](https://github.com/apple/container/blob/main/Package.swift) manifest.
- **Programmatic API** allows Swift developers to create, configure, and manage containers directly via the `RuntimeClient` module.

## Frequently Asked Questions

### Is Apple's container runtime open source?

Yes, Apple's container runtime is completely open-source. The entire project, including the `container-runtime-linux` XPC helper and CLI tools, is published under the Apache 2.0 license in the `apple/container` GitHub repository, allowing developers to inspect, modify, and redistribute the code.

### What license is the Apple container runtime under?

The runtime is distributed under the **Apache 2.0** license. This permissive open-source license permits commercial use, modification, and distribution, as confirmed by the `LICENSE` file in the root of the repository.

### Where can I find the source code for the container runtime?

The source code resides in the `apple/container` repository on GitHub. Key directories include `Sources/Services/RuntimeLinux/` for the Linux runtime service implementation and `Sources/Services/Runtime/RuntimeClient/` for the XPC client configuration and routing logic.

### What programming language is Apple's container runtime written in?

The runtime is implemented entirely in **Swift**. It utilizes the Swift Package Manager for dependency management and builds, and integrates with the open-source Containerization package—a Swift library that provides low-level container and image management capabilities.