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
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