7.10.2. プライベートレジストリーへアクセスできるように bootc を設定する
プライベートレジストリーからコンテナーイメージをプルするには、bootc ワークフローに有効な認証情報を提供する必要があります。bootc と Podman の認証情報パスを、コンテナーイメージに埋め込まれた共通の永続ファイルにシンボリックリンクすることで、環境全体でプルシークレットの single source of truth を維持できます。
前提条件
-
Bootcは、レジストリーへのプライベートアクセスを提供します。
手順
/usr/lib/container-auth.jsonレジストリー認証ファイルを作成し、以下の内容を追加します。# Make /run/containers/0/auth.json (a transient runtime file) # a symlink to our /usr/lib/container-auth.json (a persistent file) # which is also symlinked from /etc/ostree/auth.json. d /run/containers/0 0755 root root - L /run/user/0/containers/auth.json - - - - ../../../../usr/lib/container-auth.json同じディレクトリーに Containerfile を作成します。以下に例を示します。
# This example expects a secret named "creds" to contain # the registry pull secret. To build, for example # podman build --secret id=creds,src=$HOME/.docker/config.json ... FROM quay.io/<namespace>/<image>:_<tag>_ # Use a single pull secret for bootc and podman by symlinking both locations # to a common persistent file embedded in the container image. # We just make up /usr/lib/container-auth.json COPY containers-auth.conf /usr/lib/tmpfiles.d/link-podman-credentials.conf RUN --mount=type=secret,id=creds,required=true cp /run/secrets/creds /usr/lib/container-auth.json && \ chmod 0600 /usr/lib/container-auth.json && \ ln -sr /usr/lib/container-auth.json /etc/ostree/auth.jsonこれらの設定を組み込むことで、コンテナーイメージからプロビジョニングされるあらゆるシステムに対して、特定のカーネルオプションが一貫して適用されるようになります。これにより、デプロイ後の設定が不要になります。
-
プライベートレジストリー認証を設定するには、
container-auth.jsonファイルを/etc/ostree/auth.jsonに配置します。