gpt4 book ai didi

docker - 如何在docker volume ls --format中打印嵌套的字典成员值

转载 作者:行者123 更新时间:2023-12-02 19:24:03 25 4
gpt4 key购买 nike

我想使用以下命令打印Docker卷的后端卷名称
docker 卷ls --format,

以下是docker volume inspect的输出

docker volume inspect 3812bd5a8e286eb9ff9
[
{
"CreatedAt": "0001-01-01T00:00:00Z",
"Driver": "oie",
"Labels": null,
"Mountpoint": "",
"Name": "3812bd5a8e286eb9ff9",
"Options": null,
"Scope": "global",
"Status": {
"volume_detail": {
"oie_vol_name": "dcv-TL0SoIuHQvCStS1F-B5i-A",
"backend": "4000",
"compression": null,
"cpg": "cpg1",
"domain": null,
"flash_cache": null,
"fsMode": null,
"fsOwner": null,
"mountConflictDelay": 30,
"provisioning": "thin",
"size": 20,
"snap_cpg": "cpg1"
}
}
}
]


我可以使用docker volume ls -f driver=hpe --format "{{.Driver}}"提取驱动程序名称

大江

但是当我想拉 "Status": { "volume_detail": using " docker volume ls -f driver=hpe --format "{{.Status{.volume_detail{.oie_vol_name}}}}""里面的字段oie_vol_name时

表明

Template parsing error: template: :1: unexpected bad character U+007B '{' in command

最佳答案

试试这个

docker volume inspect -f "{{ .Status.volume_detail.oie_vol_name }} 3812bd5a8e286eb9ff9

希望这可以帮助。

关于docker - 如何在docker volume ls --format中打印嵌套的字典成员值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57624451/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com