Skip to content

Instantly share code, notes, and snippets.

@JuryA
Last active January 31, 2019 09:03
Show Gist options
  • Save JuryA/9cdc4ff0832a34429af75f24a9278dd1 to your computer and use it in GitHub Desktop.
Save JuryA/9cdc4ff0832a34429af75f24a9278dd1 to your computer and use it in GitHub Desktop.
Linux Shell script - Docker state DUMP
#!/bin/bash
##################################
# Docker Machines #
##################################
if [ "$debugging" -gt "0" ] && [ -n $(which docker 2>/dev/null)]; then
echo "Docker Info"
fi
PREVIFS=$IFS
IFS="$NEWLINEIFS";
for line in $(docker ps -a --format "{{.ID}}\t{{.Names}}\t{{.Status}}" 2>/dev/null); do
vm_ident=$(echo "$line" | awk '{print $1}')
name=$(echo "$line" | awk '{print $2}')
status=$(echo "$line" | awk '{print $3}')
# uuid=""
echo -n "$vm_ident:$name:$status"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment