'docker ps' output formatting: list only names of running containers

Try removing the table part from your --format argument, such as:

docker ps --format '{{.Names}}'

It should give you a simple list of container names with no table heading


Here is how we query the other columns with docker ps.

Names:

docker ps --format '{{.Names}}'

ID:

docker ps --format '{{.ID}}'

Image:

docker ps --format '{{.Image}}'

Command:

docker ps --format '{{.Command}}'

Created:

docker ps --format '{{.RunningFor}}'

Status:

docker ps --format '{{.Status}}'

Ports:

docker ps --format '{{.Ports}}'

More information can be found here.


Just a combination command, it is prettified with table.

$ docker ps --format "table {{.Image}}\t{{.Ports}}\t{{.Names}}"

IMAGE               PORTS                NAMES
nginx               0.0.0.0:80->80/tcp   nginx

In addition you can add it to .docker/config.json file that will allow you to customize the output of your docker ps command.

add to ~/.docker/config.json:

{
  "psFormat": "table {{.ID}}\\t{{.Image}}\\t{{.Status}}\\t{{.Names}}"
}