如何对结果进行排序或排序docker ps --format? [英] How to sort or order results docker ps --format?
本文介绍了如何对结果进行排序或排序docker ps --format?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在使用 docker ps
我没有找到排序结果的任何方式想要通过.Ports进行订购
In my case I want to order by .Ports
docker ps -a --format "table {{.ID}}\t{{.Names}}\t{{.Ports}}"
如何排序结果?
推荐答案
格式和顺序 docker ps
列出容器
docker ps
简介
docker ps [--format="TEMPLATE"]
--format="TEMPLATE"
Pretty-print containers using a Go template.
Valid placeholders:
.ID - Container ID
.Image - Image ID
.Command - Quoted command
.CreatedAt - Time when the container was created.
.RunningFor - Elapsed time since the container was started.
.Ports - Exposed ports.
.Status - Container status.
.Size - Container disk size.
.Names - Container names.
.Labels - All labels assigned to the container.
.Label - Value of a specific label for this container. For example {{.Label "com.docker.swarm.cpu"}}
.Mounts - Names of the volumes mounted in this container.
使用命令显示容器
docker ps --format "{{.ID}}: {{.Command}}"
在表格中显示带有标签的容器
docker ps --format "table {{.ID}}\t{{.Labels}}"
在表中显示带有节点标签的容器
docker ps --format 'table {{.ID}}\t{{(.Label "com.docker.swarm.node")}}'
这篇关于如何对结果进行排序或排序docker ps --format?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文