diff --git a/check_docker_info b/check_docker_info index cb192acae3b8555264adfe9a97dfaca28c404ab1..a7c55506c7cec68ee8e46600295000b400812346 100755 --- a/check_docker_info +++ b/check_docker_info @@ -14,7 +14,7 @@ # 2024-01-18 v1.0 <axel.hahn@unibe.ch> init # 2024-01-22 v1.1 <axel.hahn@unibe.ch> detect DOCKER; use sudo; add debug # 2024-01-23 v1.2 <axel.hahn@unibe.ch> Show a list of docker containers; add path -# 2024-01-24 v1.3 <axel.hahn@unibe.ch> remove emoji icons; handle "null" in license info +# 2024-01-24 v1.3 <axel.hahn@unibe.ch> remove emoji icons; handle "null" in license info; show rootless or not # ====================================================================== @@ -118,7 +118,6 @@ iImages=$( _getString "$data" ".Images" ) sVersion=$( _getString "$data" ".ServerVersion") sLicense=$( _getString "$data" ".ProductLicense" ) -test "$sLicense" = "null" && sLicense="no license info" # --- generate result @@ -151,7 +150,15 @@ ph.perfadd "images" "$iImages" # --- output -ph.status "Docker $sVersion ($sLicense) .. containers: $iCTotal running: $iCRunning paused: $iCPaused stopped: $iCStopped .. images: $iImages" +sStatus="Docker $sVersion (" +test -n "$sLicense" && sStatus+="$sLicense, " +test "$_is_docker_rootless" -eq "0" && sStatus+="as root" +test "$_is_docker_rootless" -eq "1" && sStatus+="rootless" +sStatus+=") .. " +sStatus+="containers: $iCTotal running: $iCRunning paused: $iCPaused stopped: $iCStopped .. " +sStatus+="images: $iImages" + +ph.status "$sStatus" echo "$out" if [ $bOptContainers -eq 1 ] && [ "$iCTotal" -gt "0" ]; then @@ -176,7 +183,7 @@ if [ $bOptContainers -eq 1 ] && [ "$iCTotal" -gt "0" ]; then fi # if -d was given then show debug infos too -test $bOptDebug -eq 1 && ( echo; echo "DEBUG: full docker system infos as json"; echo "$data" | jq ) +test $bOptDebug -eq 1 && ( echo; echo "DEBUG: full docker system infos as json"; echo "$data" | jq ; _debugInfos) ph.exit