docker format 格式

创建日期: 2022-11-01 19:30 | 作者: 风波 | 浏览次数: 16 | 分类: Docker

1. docker ps 的 format

来源:https://docs.docker.com/engine/reference/commandline/ps/

Placeholder Description
.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.
.State Container status (for example; “created”, “running”, “exited”).
.Status Container status with details about duration and health-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.
.Networks Names of the networks attached to this container.

举例:

docker ps --format "{{.ID}}: {{.Command}}"

a87ecb4f327c: /bin/sh -c #(nop) MA
01946d9d34d8: /bin/sh -c #(nop) MA
c1d3b0166030: /bin/sh -c yum -y up
41d50ecd2f57: /bin/sh -c #(nop) MA

2. docker images 的 format

docker images --format 'table {{.Repository}}:{{.Tag}}'
16 浏览
0 评论