如何对结果进行sorting或sortingdocker ps –format?
在使用docker ps
时我还没有find任何方法来sorting我的结果
在我的情况下,我想通过.Ports命令
docker ps -a --format "table {{.ID}}\t{{.Names}}\t{{.Ports}}"
我如何订购结果?
docker工人
列出容器
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")}}'