0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

AWS CodeBuild で内蔵の containerd を使って nerdctl する

Last updated at Posted at 2025-04-09

背景

CodeBuild を privilege モードで起動すると Docker が利用できるが、何らかの理由で docker 以外のコマンドを使いたい。
例えば SOCI Index を CodeBuild 上で生成するため、 nerdctl コマンドを使えるようにしたい。

検証環境

ポイント

環境変数 CONTAINERD_ADDRESS=/var/run/docker/containerd/containerd.sock でセットする。

nerdctl がデフォルトで参照する containerd のソケットは /run/containerd/containerd.sock だが、CodeBuild は containerd をそことは異なるところに作成するため、明示する必要がある。

環境変数さえセットできれば、あとは nerdctl のバイナリを落としてきて通常通り nerdctl 経由の containerd でビルド・プッシュが可能。

備考

CodeBuild で SOCI Index を作成する手順

nerdctl で通常通りビルドする

soci-snapshotter をインストールする (nerdctl-full を入れなかった場合)

wget --quiet https://github.com/awslabs/soci-snapshotter/releases/download/v${SOCI_SNAPSHOTTER_VERSION}/soci-snapshotter-${SOCI_SNAPSHOTTER_VERSION}-linux-amd64.tar.gz
tar -C /usr/local/bin -xvf soci-snapshotter-${SOCI_SNAPSHOTTER_VERSION}-linux-amd64.tar.gz soci soci-snapshotter-grpc

nerdctl で soci index と一緒に Push

nerdctl push -q --snapshotter=soci $IMAGE_URI
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?