Skip to content

Instantly share code, notes, and snippets.

@itwars
Created April 9, 2018 12:19
Show Gist options
  • Save itwars/89906b57b3650a016a6415b364992f2e to your computer and use it in GitHub Desktop.
Save itwars/89906b57b3650a016a6415b364992f2e to your computer and use it in GitHub Desktop.
help on docker --format
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")}}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment