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。要将存储附加到 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