16.5. コンテナーでの Buildah の実行
この手順では、コンテナーで Buildah を実行し、イメージを基に作業コンテナーを作成する方法を説明します。
前提条件
-
container-tools
メタパッケージがインストールされている。
手順
registry.redhat.io レジストリーにログインします。
podman login registry.redhat.io
$ podman login registry.redhat.io Username: myuser@mycompany.com Password: <password> Login Succeeded!
Copy to Clipboard Copied! Toggle word wrap Toggle overflow registry.redhat.io/rhel10/buildah
イメージをプルして実行します。podman run --rm --device /dev/fuse -it \ registry.redhat.io/rhel10/buildah /bin/bash
# podman run --rm --device /dev/fuse -it \ registry.redhat.io/rhel10/buildah /bin/bash
Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
--rm
オプションは、コンテナーの終了後にregistry.redhat.io/rhel10/buildah
イメージを削除します。 -
--device
オプションは、ホストデバイスをコンテナーに追加します。 -
sys_chroot
- 別のルートディレクトリーに変更する機能。コンテナーのデフォルト機能には含まれていません。
-
registry.access.redhat.com/ubi10/
イメージを使用して、新しいコンテナーを作成します。buildah from registry.access.redhat.com/ubi10/
# buildah from registry.access.redhat.com/ubi10/ ... ubi10/-working-container
Copy to Clipboard Copied! Toggle word wrap Toggle overflow ubi10/-working-container
コンテナー内でls /
コマンドを実行します。buildah run --isolation=chroot ubi10/-working-container ls /
# buildah run --isolation=chroot ubi10/-working-container ls / bin boot dev etc home lib lib64 lost+found media mnt opt proc root run sbin srv
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 必要に応じて、ローカルストレージ内の全イメージをリスト表示します。
buildah images
# buildah images REPOSITORY TAG IMAGE ID CREATED SIZE registry.access.redhat.com/ubi10/ latest ecbc6f53bba0 5 weeks ago 211 MB
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 必要に応じて、作業用コンテナーとそのベースイメージをリスト表示します。
buildah containers
# buildah containers CONTAINER ID BUILDER IMAGE ID IMAGE NAME CONTAINER NAME 0aaba7192762 * ecbc6f53bba0 registry.access.redhat.com/ub... ubi10/-working-container
Copy to Clipboard Copied! Toggle word wrap Toggle overflow オプション:
registry.access.redhat.com/ubi10/
イメージをregistry.example.com
にあるローカルレジストリーにプッシュします。buildah push ecbc6f53bba0 registry.example.com:5000/ubi10/ubi
# buildah push ecbc6f53bba0 registry.example.com:5000/ubi10/ubi
Copy to Clipboard Copied! Toggle word wrap Toggle overflow