Closed6

macOS 26でcontainerを使ってコンテナを動かすまで

ironyirony

macOS Sequoiaを使っていたのでmacOS Tahoeにアップデート
これまでのOSアップデートと同じくシステム設定から

ironyirony

https://github.com/apple/container/releases から最新バージョンのpkgをダウンロード
このスクラップを残している時点での最新バージョンは0.4.1だったのでcontainer-0.4.1-installer-signed.pkgをダウンロード

ironyirony

ダウンロードしたpkgファイルを開き、containerをインストール
インストール先のディレクトリは選択できなかった
ターミナルを開いてcontainerコマンドがインストールされていることを確認

$ command -v container
/usr/local/bin/container
$ container --help
OVERVIEW: A container platform for macOS

USAGE: container [--debug] <subcommand>
.
.
.
PLUGINS: not available, run `container system start`
ironyirony

helpを見ると起動されていないみたいだったので指示されたコマンドを実行
おすすめされたのでデフォルトのkernelをインストール

PLUGINS: not available, run container system start

$ container system start
Verifying apiserver is running...
No default kernel configured.
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]: Y
Installing kernel...

もう一度helpを見るとnot availableが消えていた
statusを見るとapiserverが起動されていそうなことがわかる

$ container system status
apiserver is running
application data root: ${HOME}/Library/Application Support/com.apple.container/
application install root: /usr/local/
container-apiserver version: container-apiserver version 0.4.1 (build: release, commit: xxxxxxx)
container-apiserver commit: xxxxxxx
ironyirony

イメージのリストを表示してみると何も表示されない
docker pull 的なことをしていないので想定通り

$ container images list
NAME  TAG  DIGEST

デフォルトのregistryはdocker.ioとのこと

$ container registry default inspect
docker.io

alpineのlatestを試しにインストールしてみると、イメージのリストにalpineが表示された🎉

$ container images pull alpine:latest

$ container images list         
NAME    TAG     DIGEST
alpine  latest  xxxxxxx...
ironyirony

hello worldが実行できコンテナを動かすところまで確認できた🎉

$ container run -it alpine:latest echo 'Hello, world'
Hello, world
このスクラップは1日前にクローズされました