Docker Community Forums

Share and learn in the Docker community.

How can i compare the number of containers with a integer number


#1

what is the type of a function that return the number of containers?
I need the type to compare the result return by the function to an integer number


(Gary Forghetti) #2

You can use the docker system info command. There are 4 counters:
Containers - total of all containers - Running + Paused + Stopped

$ docker system info --format '{{ .Containers }}' 
20
$ docker system info --format '{{ .ContainersRunning }}' 
16
$ docker system info --format '{{ .ContainersPaused }}' 
0
$ docker system info --format '{{ .ContainersStopped }}'
4