Skip to content
Snippets Groups Projects

update docker ps --format

Merged Hahn Axel (hahn) requested to merge docker-checks into master
2 files
+ 168
2
Compare changes
  • Side-by-side
  • Inline

Files

+ 5
2
@@ -17,13 +17,14 @@
@@ -17,13 +17,14 @@
# 2024-01-23 v1.2 <axel.hahn@unibe.ch> Show a list of docker containers; add path
# 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; show rootless or not
# 2024-01-24 v1.3 <axel.hahn@unibe.ch> remove emoji icons; handle "null" in license info; show rootless or not
# 2024-01-29 v1.4 <axel.hahn@unibe.ch> add --target option
# 2024-01-29 v1.4 <axel.hahn@unibe.ch> add --target option
 
# 2024-02-13 v1.5 <axel.hahn@unibe.ch> update docker ps --format
# ======================================================================
# ======================================================================
. $(dirname $0)/inc_pluginfunctions
. $(dirname $0)/inc_pluginfunctions
. $(dirname $0)/inc_dockerfunctions.sh
. $(dirname $0)/inc_dockerfunctions.sh
self_APPVERSION=1.4
self_APPVERSION=1.5
# ----------------------------------------------------------------------
# ----------------------------------------------------------------------
# FUNCTIONS
# FUNCTIONS
@@ -176,7 +177,9 @@ echo "$out"
@@ -176,7 +177,9 @@ echo "$out"
if [ $bOptContainers -eq 1 ] && [ "$iCTotal" -gt "0" ]; then
if [ $bOptContainers -eq 1 ] && [ "$iCTotal" -gt "0" ]; then
echo
echo
echo "Containers:"
echo "Containers:"
containers=$( sudo -n --preserve-env docker ps --all --format "{{ json . }}" --all 2>/dev/null )
# containers=$( sudo -n --preserve-env docker ps --all --format "{{ json . }}" --all 2>/dev/null )
 
containers=$( sudo -n --preserve-env docker ps --all --format '{"Names": "{{.Names}}", "State": "{{.State}}", "Status": "{{.Status}}" }' 2>/dev/null )
 
echo "$containers" | while read -r line; do
echo "$containers" | while read -r line; do
sName=$( _getString "$line" ".Names" )
sName=$( _getString "$line" ".Names" )
sState=$( _getString "$line" ".State" )
sState=$( _getString "$line" ".State" )
Loading