コンテンツへスキップ
LatchkeyLatchkey home

CI runner image(またはAMI)とは何か?

runner imageはrunnerが起動するためのビルド済みテンプレートです - OSに加えて、厳選されたツールやSDKがすでにインストールされており、jobが毎回それらをゼロからインストールする必要がありません。

image、AMI(AWS上)、VMテンプレートのいずれと呼ばれても、考え方は同じです。作業準備の整ったマシンのsnapshotです。そのimageの中身が、CIがどれだけ速く、どれだけ一貫しているかを大きく左右します。

imageに含まれるもの

runner imageには、オペレーティングシステム、一般的な言語ランタイムとSDK、buildツール、そしてrunnerエージェント自体が焼き込まれます。runnerが起動すると、このimageをブートしてすぐにjobを拾える状態になり - 実行ごとにベースのtoolchainを長々とプロビジョニングする必要がありません。

事前に焼き込むことが重要な理由

  • 速度: ツールが起動時に存在するため、jobはベースツールのインストールを省けます。
  • 一貫性: すべてのrunnerが同一の既知のベースラインから始まります。
  • 再現性: imageのバージョンを固定することで、すべてのjobのtoolchainが固定されます。

AMIについて具体的に

AWSでは、imageはAMI(Amazon Machine Image)です - EC2インスタンスが起動元とするディスクテンプレートです。self-hostedまたはマネージドのrunnerフリートは通常、jobが必要とするツールをちょうど揃えたカスタムAMIをビルドし、各インスタンスが起動時にすべてをインストールするのではなく、事前ロード済みで立ち上がるようにします。

トレードオフ

リッチなimageはより多くのjobに対して準備が整った状態で起動しますが、サイズが大きく、焼き込んだツールが変わるたびにrebuildして再公開しなければなりません。より無駄のないimageは小さくて保守しやすいものの、jobに実行時のインストールをより多く強いります。バランスは、ほとんどのjobが必要とするものを含めつつ、まれで重いツールはjobごとのインストールやcacheに委ねることです。

重要なポイント

  • runner imageはrunnerが起動するためのビルド済みテンプレートです。
  • AWSではそのテンプレートは、EC2インスタンスが起動元とするAMIです。
  • ツールを事前に焼き込むことで、速度、一貫性、再現性が得られます。
  • リッチなimageは起動時に準備が整いますが、サイズとrebuildのchurnを要します - バランスを取りましょう。

よくある質問

What is What is a CI runner image (or AMI)??
Whether it is called an image, an AMI (on AWS), or a VM template, it is the same idea: a snapshot of a ready-to-work machine. The contents of that image largely determine how fast and how consistent your CI is.
What is in the image?
A runner image bakes in the operating system, common language runtimes and SDKs, build tools, and the runner agent itself. When a runner launches, it boots this image and is immediately ready to pick up a job - no lengthy provisioning of the base toolchain per run.
AMI specifically?
On AWS, the image is an AMI (Amazon Machine Image) - the disk template an EC2 instance launches from. A self-hosted or managed runner fleet typically builds a custom AMI with exactly the tools its jobs need, so each instance comes up pre-loaded rather than installing everything at boot.
The trade-offs?
A richer image boots ready for more jobs but is larger and must be rebuilt and re-published whenever the baked tools change. A leaner image is smaller and easier to maintain but forces jobs to install more at runtime. The balance is including what most jobs need while leaving rare, heavy tools to per-job install or caching.

関連ガイド