我们如何使用docker命令格式化docker API输出,例如
docker inspect <Image id> --format "{{json .Tag}}"
命令为您提供主机上可用的所有图像的标记列表。
如何使用docker API获取此格式化信息?
例如http:localhost/images/<image id>/json?<something..>
Docker的API不支持任何格式化。 --format
标志仅在客户端实现。您可能希望查看像https://stedolan.github.io/jq/这样的工具来进行格式化。