概要
Containerは、Mac上でLinuxコンテナを軽量な仮想マシンとして作成し実行するためのツールです。Swiftで書かれており、Appleシリコン向けに最適化されています。
Apple Container は、OCI(Open Container Initiative)に準拠しているのでDockerイメージを動作させることが可能です
インストール
以下のURLにアクセスして、
Release 0.3.0 · apple/container
A big thank you to all contributors for your work to improve container!Beginning with the 0.3.0 release, we're aiming to...
「container-0.3.0-installer-signed.pkg」をクリックしてダウンロードします

ダウンロードしたらダブルクリックします。
以下の画面が表示されるので、「続ける」をクリック

「インストール」をクリック

インストールが完了したら「閉じる」をクリック

動作確認
ターミナルで以下のコマンドを実行してインストールが正常にできているか確認します
container --version
以下は実行結果です。version 0.3.0であれば、2025年8月現在で最新です

エラー
macOSのバージョンが古いと下記のエラーが表示されると思います。この場合は、macOS15.0以上までアップグレードしてください
container --version
dyld[21136]: Library not loaded: /usr/lib/swift/libswiftSynchronization.dylib
Referenced from: <3BD7ACA3-ACD6-3077-AA54-6308FEB0B6E0> /usr/local/bin/container (built for macOS 15.0 which is newer than running OS)
Reason: tried: '/usr/lib/swift/libswiftSynchronization.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/usr/lib/swift/libswiftSynchronization.dylib' (no such file), '/usr/lib/swift/libswiftSynchronization.dylib' (no such file, not in dyld cache)
zsh: abort container --version
動作検証をしているmacがVenturaだったので動作しませんでした

初期設定
以下のコマンドでcontainerシステムを起動させます
container system start
と聞かれるので「y」を入力してエンターを押します
Install the recommended default kernel from [https://github.com/kata-containers/kata-containers/releases/download/3.17.0/kata-static-3.17.0-arm64.tar.xz]? [Y/n]:

以下のコマンドで起動を確認します
container system status
以下は実行結果で「running」になっていれば起動しています

実行
コンテナを実行します
以下コマンドで動作確認の「hello-world」コンテナを実行します
container run hello-world

コンテナリスト
コンテナの一覧を確認するコマンドは、以下のコマンドで確認できます
container list --all

コンテナイメージコマンド
$ container image
OVERVIEW: Manage images
USAGE: container images <subcommand>
OPTIONS:
--version Show the version.
-h, --help Show help information.
SUBCOMMANDS:
inspect Display information about one or more images
list, ls List images
load Load images from an OCI compatible tar archive
prune Remove unreferenced and dangling images
pull Pull an image
push Push an image
delete, rm Remove one or more images
save Save an image as an OCI compatible tar archive
tag Tag an image
See 'container help images <subcommand>' for detailed help.
コメント