legacy-knowledge-base
公開されました Sep. 10, 2025

initcontainerのDeployフォルダをコンテナで利用できるように保持する方法

written-by

Kenny Back

How To articles are not official guidelines or officially supported documentation. They are community-contributed content and may not always reflect the latest updates to Liferay DXP. We welcome your feedback to improve How To articles!

While we make every effort to ensure this Knowledge Base is accurate, it may not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with any feedback or concerns.

legacy-article

learn-legacy-article-disclaimer-text

問題

  • initcontainerで作成したdeployフォルダを永続化し、コンテナで利用できるようにする方法はありますか?

環境

  • DXP 7.4

解像度

  • 解決策として考えられるのは、コンテナ間で共有ボリュームを使用することだろう。 Kubernetesのinitコンテナでボリュームを使うことができる。 ボリュームは、同じポッド内のinitコンテナとメインアプリケーションコンテナ間で共有できる。 ここでは、initコンテナでボリュームを定義して使用する方法の一般的な概要を説明します:
  1. ボリュームを定義します:ポッドの仕様でボリュームを定義します。
  2. init コンテナにボリュームをマウントする:必要に応じて、initコンテナにボリュームをマウントする。
  3. アプリケーションコンテナにボリュームをマウントする:メイン・アプリケーション・コンテナに同じボリュームをマウントする。
  • これらの手順を示すYAMLコンフィギュレーションの例を以下に示す:
apiVersion: v1 
kind: Pod
metadata:
name: example-pod
spec: volumes:
- name: shared-data
emptyDir: {}

initContainers:
- name: init-container
image: busybox
command: ['sh', '-c', 'echo "Initializing..." > /mnt/data/init.log']
volumeMounts:
- name: shared-data
mountPath: /mnt/data

containers:
- name: app-container
image: busybox
command: ['sh', '-c', 'cat /mnt/data/init.log && sleep 3600']
volumeMounts:
- name: shared-data
mountPath: /mnt/data

追加情報

did-this-article-resolve-your-issue

legacy-knowledge-base