开发者社区> 问答> 正文

如何排序或排序结果docker ps --format?

如何排序或排序结果docker ps --format?

展开
收起
游客5k6m7fein3w74 2021-10-21 14:43:03 2143 0
1 条回答
写回答
取消 提交回答
  • 格式化和订购 docker ps 列出容器

    docker ps 格式

    docker ps -a --format "table {{.ID}}\t{{.Names}}\t{{.Ports}}" | (read -r; printf "%s\n" "$REPLY"; sort -k 3 ) 概要

    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")}}'

    2021-10-21 15:08:24
    赞同 展开评论 打赏
问答分类:
问答标签:
问答地址:
问答排行榜
最热
最新

相关电子书

更多
应用 Docker 进行持续交付:用技术改变交付路程 立即下载
从Docker到容器服务 立即下载
构建基因数据应用生态系统—— docker in Bio/informatics 立即下载