3.5.9.4. 特定のコンテナーへのストレージの追加
devfile に複数のコンテナーがある場合、odo storage create コマンドで --container フラグを使用して、ストレージを割り当てるコンテナーを指定できます。
以下の例は、複数のコンテナーを持つ devfile の抜粋です。
components:
- name: nodejs1
container:
image: registry.access.redhat.com/ubi8/nodejs-12:1-36
memoryLimit: 1024Mi
endpoints:
- name: "3000-tcp"
targetPort: 3000
mountSources: true
- name: nodejs2
container:
image: registry.access.redhat.com/ubi8/nodejs-12:1-36
memoryLimit: 1024Mi
この例では、nodejs1 と nodejs2 の 2 つのコンテナーがあります。ストレージを nodejs2 コンテナーに割り当てるには、以下のコマンドを使用します。
$ odo storage create --container
出力例:
$ odo storage create store --path /data --size 1Gi --container nodejs2
✓ Added storage store to nodejs-testing-xnfg
Please use `odo push` command to make the storage accessible to the component
odo storage list コマンドを使用して、ストレージリソースを一覧表示できます。
$ odo storage list
出力例:
The component 'nodejs-testing-xnfg' has the following storage attached:
NAME SIZE PATH CONTAINER STATE
store 1Gi /data nodejs2 Not Pushed