How to check docker instance is running in Bash How to check docker instance is running in Bash docker docker

How to check docker instance is running in Bash


A simple docker ps --format "{{.ID}} {{.Command}} {{.Status}}" would be easier to parse, as it would only have three columns.

With formatting, you can only display the bare minimum information you need, and have the separator you want between each column.

The OP loretoparisi recommends in the comments:

docker ps -a --format "{{.ID}}\t\"{{.Status}}\"\t{{.Names}}" | cut -f2 -d$'\t' 

to get col 2, or you could do:

docker ps -a --format "{{.ID}}\t\"{{.Status}}\"\t{{.Names}}" | awk -F$"\t" '{printf "%s|%s|%s\n", $1, $2, $3}' 

to rule them all!