Buildah : Scratch から作成する2025/11/03 |
|
空コンテナーイメージ [scratch] でゼロからコンテナーイメージを作成します。 |
|
| [1] | 空コンテナーイメージ [scratch] を指定して開始します。 |
|
# 空コンテナーイメージ [scratch] を作成 dlp:~ # newcontainer=$(buildah from scratch) dlp:~ # buildah containers CONTAINER ID BUILDER IMAGE ID IMAGE NAME CONTAINER NAME 829267909ac0 * 004d9956dc10 registry.opensuse.org/opensus... leap-working-container 38e332989942 * 004d9956dc10 registry.opensuse.org/opensus... leap-working-container-1 21ec3a3a154b * scratch working-container # 空コンテナーイメージ [scratch] をマウント dlp:~ # scratchmnt=$(buildah mount $newcontainer) dlp:~ # echo $scratchmnt /var/lib/containers/storage/overlay/766a844f78c466cdf4dcfb064c0a7b13f2d1eb7ffe5ca2fca67342c047a9e87e/merged # 空コンテナーイメージにパッケージインストール dlp:~ # zypper --installroot=$scratchmnt -n install -t pattern minimal_base
# アンマウント dlp:~ # buildah umount $newcontainer 21ec3a3a154bdf64d68dc72b396c3fff57561985374525943793cd0c00c52d40 # コンテナー起動 dlp:~ # buildah run $newcontainer bash bash-5.2# bash-5.2# cat /etc/os-release NAME="openSUSE Leap" VERSION="16.0" ID="opensuse-leap" ID_LIKE="suse opensuse" VERSION_ID="16.0" PRETTY_NAME="openSUSE Leap 16.0" ANSI_COLOR="0;32" CPE_NAME="cpe:/o:opensuse:leap:16.0" BUG_REPORT_URL="https://bugs.opensuse.org" HOME_URL="https://www.opensuse.org/" DOCUMENTATION_URL="https://en.opensuse.org/Portal:Leap" LOGO="distributor-logo-Leap"
bash-5.2#
# イメージ登録 dlp:~ # buildah commit $newcontainer suse-minimum:leap16 Getting image source signatures Copying blob dad703b8faaf done | Copying config 9f4691a5fe done | Writing manifest to image destination 9f4691a5fea94e14b9a1bd120cc407bd7a2f603abc46846bc3a69a672731c028dlp:~ # buildah images REPOSITORY TAG IMAGE ID CREATED SIZE localhost/suse-minimum leap16 9f4691a5fea9 16 seconds ago 235 MB localhost/my-suse latest 4e32bac03939 14 minutes ago 425 MB registry.opensuse.org/opensuse/leap latest 004d9956dc10 2 weeks ago 118 MB |
| Sponsored Link |
|
|