← logs

container machine はどの程度 VM に近いのか検証する

2026年6月9日

Apple container の container machine が、どの程度 VM に近い Linux 環境として使えるのかを確認する。

tags: Apple, Container, macOS, Virtualization

WIP 2026-06-09 22:46 JST

はじめに

Apple container は、コンテナを軽量 VM として動かす設計に近い。 さらに v1.0.0 では、長く使う Linux 環境を作る機能として container machine が追加された。

では、container machine はどの程度 VM に近いのか。また、containerコマンドで起動する通常のコンテナと何が違うのか。

この記事では、container machine を Linux 作業環境として見たときに、どこまで VM らしく振る舞うのかを確認する。

見たいこと

検証方針

まず、Alpine の container machine を作る。 Alpine では OpenRC まわりを見る。

container machine create alpine:3.22 --name alpine-machine
container machine run -n alpine-machine

次に、systemd を含む Ubuntu image でも container machine を作る。 公式 how-to では、Ubuntu 24.04 に systemd、SSH、基本的な CLI ツールを入れた image を作る例が示されている。

FROM ubuntu:24.04

RUN apt-get update && \
    apt-get install -y systemd dbus sudo iproute2 iputils-ping curl && \
    apt-get clean && \
    rm -rf /var/lib/apt/lists/*

RUN systemctl set-default multi-user.target
container build -t local/ubuntu-machine:latest .
container machine create local/ubuntu-machine:latest --name ubuntu-machine
container machine run -n ubuntu-machine

その上で、Linux から見える環境を確認する。

uname -a
cat /etc/os-release
cat /proc/1/comm
readlink -f /sbin/init
ps aux
systemctl status
journalctl -b --no-pager | tail
mount
findmnt
cat /proc/self/cgroup
ip addr
df -h
free -h

同じコマンドを container run でも実行し、差分を見る。

container run --rm alpine:3.22 uname -a
container run --rm alpine:3.22 ps aux
container run --rm alpine:3.22 mount

期待していること

container machine は、Docker Desktop の中の通常のコンテナというより、軽量 VM に近い Linux 作業環境として見えるはずである。

一方で、完全な汎用 VM ではない可能性もある。 Apple container の管理下にあるため、kernel、network、mount、host integration には独自の制約があるはずである。

この差分を見ることで、container machine を開発環境や検証環境としてどこまで使えるかを整理したい。

関連ログ