7.6. bootc-image-builder を使用して作成するディスクイメージへの設定の注入
build config
、つまり作成するイメージのカスタマイズを含む .toml
または .json ファイルを使用すると、カスタムイメージに設定を注入できます。`build config
ファイルは、コンテナーディレクトリーの /config.toml
にマップされます。次の例は、作成するディスクイメージにユーザーを追加する方法を示しています。
手順
./config.toml
を作成します。次の例は、ディスクイメージにユーザーを追加する方法を示しています。[[customizations.user]] name = "user" password = "pass" key = "ssh-rsa AAA ... user@email.com" groups = ["wheel"]
[[customizations.user]] name = "user" password = "pass" key = "ssh-rsa AAA ... user@email.com" groups = ["wheel"]
Copy to Clipboard Copied! -
NAME
- 必須。ユーザーの名前です。 -
password
- 必須ではありません。暗号化されていないパスワードです。 -
key
- 必須ではありません。SSH 公開鍵の内容です。 -
groups
- 必須ではありません。ユーザーの追加先グループの配列です。
-
bootc-image-builder
を実行します。./config.toml
を含む次の引数を渡します。sudo podman run \ --rm \ -it \ --privileged \ --pull=newer \ --security-opt label=type:unconfined_t \ -v $(pwd)/config.toml:/config.toml \ -v $(pwd)/output:/output \ registry.redhat.io/rhel9/bootc-image-builder:latest \ --type qcow2 \ --config config.toml \ quay.io/<namespace>/<image>:<tag>
$ sudo podman run \ --rm \ -it \ --privileged \ --pull=newer \ --security-opt label=type:unconfined_t \ -v $(pwd)/config.toml:/config.toml \ -v $(pwd)/output:/output \ registry.redhat.io/rhel9/bootc-image-builder:latest \ --type qcow2 \ --config config.toml \ quay.io/<namespace>/<image>:<tag>
Copy to Clipboard Copied! たとえば、
virt-install
を使用して仮想マシンを起動します。sudo virt-install \ --name bootc \ --memory 4096 \ --vcpus 2 \ --disk qcow2/disk.qcow2 \ --import \ --os-variant rhel9
$ sudo virt-install \ --name bootc \ --memory 4096 \ --vcpus 2 \ --disk qcow2/disk.qcow2 \ --import \ --os-variant rhel9
Copy to Clipboard Copied!
検証
SSH でシステムにアクセスします。
ssh -i /<path_to_private_ssh-key> <user1>_@_<ip-address>
# ssh -i /<path_to_private_ssh-key> <user1>_@_<ip-address>
Copy to Clipboard Copied!
次のステップ
- コンテナーイメージをデプロイした後、イメージを更新し、変更をレジストリーにプッシュできます。RHEL のブート可能なイメージの管理 を参照してください。