8 lines
355 B
Bash
Executable File
8 lines
355 B
Bash
Executable File
#!/bin/bash
|
|
|
|
# Read docker ps output and format
|
|
docker_ps_output=$(docker ps --format '{{.Names}}: <b>{{.Image}}</b>\n' | column -t -o ' ' | sed ':a;N;$!ba;s/\n/\\n/g')
|
|
|
|
active_container_cnt=$(echo -e $docker_ps_output | grep -c "<b>")
|
|
echo "{ \"text\": \"$active_container_cnt\", \"tooltip\": \"$docker_ps_output\", \"class\": \"\", \"percentage\": 0 }"
|