docker ps
Displays all the running containers
I want to display the total number of running containers
The command,
docker ps | wc -l
displays the line count but also counts headers as lines.
How do I exclude headers?
Also, is there another way to print the total number of running containers?
2
Answers
Have a look here
https://docs.docker.com/engine/reference/commandline/ps/#formatting
If you dont use the table directive it wont show the headers
You should be able to pipe that in to wc -l
docker info
display the number of running containers like next:You could format the output using next to get the running containers: