# Dependencies for Apple's Container: Complete Package.swift Analysis

> Discover Apple's Container dependencies. Analyze 16 Swift package dependencies in Package.swift, from core primitives to networking and CLI tools. Get the complete package list now.

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

---

**Apple's Container declares 16 Swift package dependencies in its root [`Package.swift`](https://github.com/apple/container/blob/main/Package.swift), ranging from core runtime primitives (`containerization`) to networking stacks (`swift-nio`, `grpc-swift`), configuration parsers (`swift-toml`, `Yams`), and CLI tooling (`swift-argument-parser`).**

The [apple/container](https://github.com/apple/container) repository provides a Swift-native container runtime for managing OCI-compliant workloads. Understanding the dependencies for Apple's container is critical for developers contributing to the runtime or integrating its libraries into downstream tools, as the architecture relies on a tightly curated mix of Apple's internal packages and battle-tested open-source libraries.

## Core Runtime and System Dependencies

At the foundation of the dependency graph sits the **containerization** package, declared at [`Package.swift`](https://github.com/apple/container/blob/main/Package.swift) line 56 with an exact version constraint:

```swift
.package(url: "https://github.com/apple/containerization.git", exact: "0.33.4")

```

This internal Apple library provides low-level container runtime primitives, including OCI image handling, filesystem layer management, and VM orchestration. Because it is pinned to an exact version (`0.33.4`), the project ensures reproducible builds of these critical runtime components.

Supporting system-level operations are:

- **swift-system** (`≥ 1.6.4`): Exposes low-level system APIs for file descriptors and process handling across POSIX platforms.
- **swift-collections** (`≥ 1.2.0`): Supplies high-performance data structures like `Deque` and `OrderedDictionary` used throughout the codebase for managing container metadata and large workloads.

## CLI and Configuration Stack

The command-line interface and configuration management layers depend on a sophisticated parsing stack:

- **swift-argument-parser** (`≥ 1.3.0`): Powers the declarative CLI for tools like `container` and `container-runtime-linux`, defined in [`Sources/CLI/main.swift`](https://github.com/apple/container/blob/main/Sources/CLI/main.swift).
- **swift-configuration** (`≥ 1.0.0`): Provides typed configuration handling for JSON, TOML, and environment variables, consumed by [`Sources/ContainerPlugin/Plugin.swift`](https://github.com/apple/container/blob/main/Sources/ContainerPlugin/Plugin.swift).
- **swift-log** (`≥ 1.0.0`): Implements structured logging across every service and plugin, bootstrapped in the application entry points.

For configuration file formats, the project pulls in:

- **swift-toml** (`≥ 2.0.0`) and **swift-configuration-toml** (`≥ 2.0.0`): Handle TOML parsing for [`config.toml`](https://github.com/apple/container/blob/main/config.toml) files.
- **Yams** (`≥ 6.2.1`): Parses legacy YAML configuration formats.

## Networking and Communication Layer

Container-to-host and inter-service communication relies on Swift NIO and the gRPC ecosystem:

- **swift-nio** (`≥ 2.80.0`): Provides asynchronous networking and event-loop abstractions used by `ContainerAPIService`, the DNS server, and HTTP clients.
- **grpc-swift-2** (`≥ 2.3.0`): Core gRPC library for client and server RPC implementations.
- **grpc-swift-nio-transport** (`≥ 2.4.4`): HTTP/2 transport layer binding gRPC to Swift NIO.
- **grpc-swift-protobuf** (`≥ 2.2.0`): Bridges Swift Protobuf with gRPC for code generation.

Serialization and external HTTP communication are handled by:

- **swift-protobuf** (`≥ 1.36.0`): Compiles Protobuf definitions for container specs, image manifests, and runtime messages.
- **async-http-client** (`≥ 1.20.1`): High-performance HTTP client used specifically by `container-apiserver` to communicate with remote registries.

Documentation generation is automated via **swift-docc-plugin** (`≥ 1.1.0`), which processes source annotations into API documentation.

## How Dependencies Map to Source Architecture

In [`Package.swift`](https://github.com/apple/container/blob/main/Package.swift) lines 56-71, dependencies are declared as external package requirements that feed into specific targets:

- **CLI Layer** ([`Sources/CLI/main.swift`](https://github.com/apple/container/blob/main/Sources/CLI/main.swift)): Consumes `swift-argument-parser` to expose commands like `container build` and `container run`.
- **Networking Services** ([`Sources/Services/ContainerAPIService/Server/ContainerAPIService.swift`](https://github.com/apple/container/blob/main/Sources/Services/ContainerAPIService/Server/ContainerAPIService.swift)): Links against `swift-nio`, `grpc-swift-2`, and `grpc-swift-nio-transport` to handle high-throughput RPC between the host and container processes.
- **Persistence Layer** ([`Sources/ContainerPlugin/Plugin.swift`](https://github.com/apple/container/blob/main/Sources/ContainerPlugin/Plugin.swift)): Uses `swift-configuration`, `swift-toml`, and `Yams` to read and write TOML/YAML configuration files, while `swift-log` provides uniform logging.
- **API Client** ([`Sources/ContainerAPIClient/ContainerAPIClient.swift`](https://github.com/apple/container/blob/main/Sources/ContainerAPIClient/ContainerAPIClient.swift)): Combines `async-http-client` with `swift-protobuf` to communicate with the container runtime API.

## Example: Importing the Container API Client

When integrating Apple's Container into your own Swift package, you interact with the same dependency stack. The following example demonstrates importing the `ContainerAPIClient` and its transitive dependencies (`swift-log`, `swift-protobuf`, `swift-nio`) to list containers:

```swift
import ContainerAPIClient
import ArgumentParser
import Logging

struct ListContainers: ParsableCommand {
    func run() throws {
        LoggingSystem.bootstrap { _ in
            var logger = Logger(label: "example")
            logger.logLevel = .info
            return logger
        }

        let client = try ContainerAPIClient(host: "localhost", port: 8080)
        let containers = try client.listContainers()
        for c in containers {
            print("🛠️  \(c.id) – \(c.name)")
        }
    }
}
ListContainers.main()

```

This snippet assumes your [`Package.swift`](https://github.com/apple/container/blob/main/Package.swift) declares a dependency on the `ContainerAPIClient` product, which automatically pulls in the protobuf, NIO, and logging libraries declared in the main project's dependency list.

## Summary

- **Apple's Container** manages 16 external Swift dependencies declared in [`Package.swift`](https://github.com/apple/container/blob/main/Package.swift) lines 56-71.
- The **containerization** package (exact version 0.33.4) is an internal Apple dependency providing core OCI runtime primitives.
- **swift-nio**, **grpc-swift**, and **async-http-client** form the asynchronous networking stack for container RPC and registry communication.
- **swift-argument-parser**, **swift-configuration**, **swift-toml**, and **Yams** handle CLI input and configuration file parsing.
- **swift-protobuf** and **grpc-swift-protobuf** manage serialization of container specs and runtime messages.

## Frequently Asked Questions

### What is the minimum Swift version required for Apple's Container dependencies?

While [`Package.swift`](https://github.com/apple/container/blob/main/Package.swift) does not explicitly declare a Swift toolchain version in the provided analysis, the dependency constraints (particularly `swift-nio ≥ 2.80.0` and `grpc-swift-2 ≥ 2.3.0`) typically require Swift 5.10 or newer. The `swift-system` dependency (`≥ 1.6.4`) also mandates recent compiler support for low-level systems programming.

### Is the containerization package open source?

Yes, the **containerization** package is available at `https://github.com/apple/containerization.git`, but it is version-pinned to `exact: 0.33.4` in the main container project. This exact constraint ensures API stability for the core runtime primitives while allowing the containerization library to evolve independently.

### How do I add Apple's Container as a dependency to my Swift project?

Add the following to your [`Package.swift`](https://github.com/apple/container/blob/main/Package.swift) dependencies array, then add the specific product (e.g., `ContainerAPIClient`) to your target:

```swift
.package(url: "https://github.com/apple/container.git", from: "0.1.0")

```

This will resolve the full dependency graph including `swift-nio`, `swift-protobuf`, and the gRPC stack transitively.

### Which dependency handles the gRPC communication between containers and the host?

The **grpc-swift-2** package (`≥ 2.3.0`) provides the core gRPC client and server implementation, while **grpc-swift-nio-transport** (`≥ 2.4.4`) supplies the HTTP/2 transport layer over Swift NIO. These are used by `ContainerAPIService` and `ContainerAPIClient` to manage container lifecycle RPCs.