base imageとは?
base imageとは、DockerfileがFROM命令で上に構築していく基盤となるコンテナイメージで、オペレーティングシステムのレイヤー、システムライブラリ、多くの場合は言語ランタイムを提供します。アプリケーションのレイヤーはその上に追加されます。base imageの選択は、最終イメージのサイズ、セキュリティ体制、互換性を左右します。
なぜ重要か
base imageはイメージサイズと脆弱性の露出の下限を決めます。肥大化しており滅多にパッチされないベースは、すべてのビルドの足を引っ張ります。最小限で、よく保守され、digestにピン留めされたbase image、あるいはdistrolessを選ぶことで、イメージは小さく、安全で、再現可能に保たれます。
関連する概念
- FROM命令で選択される
- distrolessのベースはサイズと攻撃対象領域を最小化する
- 再現性のためdigestにピン留めする
関連ガイド
What Is a Distroless Image?A distroless image contains only your application and its runtime dependencies, with no shell, package manage…
What Is an Image Digest?An image digest is a cryptographic hash that uniquely and immutably identifies the exact contents of a contai…
What Is a Multi-Stage Build?A multi-stage build uses several stages in one Dockerfile to compile in a heavy stage but ship only the slim…