Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

docker ps: how to show specific columns as output?

Tags:

docker

docker ps: showing multiple-lines for each container makes it difficult to see.

How to select columns to display like sql?

docker ps -a ID,NAME,STATUS
like image 730
eastwater Avatar asked Nov 22 '25 00:11

eastwater


1 Answers

Use --format:

docker ps --format "table {{.ID}}\t{{.Names}}\t{{.Status}}"
CONTAINER ID   NAMES     STATUS

Also please read the help section: docker ps --help which references: https://docs.docker.com/go/formatting/

table

table specifies which fields you want to see its output.

$ docker image list --format "table {{.ID}}\t{{.Repository}}\t{{.Tag}}\t{{.Size}}"

like image 120
Ron Avatar answered Nov 25 '25 00:11

Ron