Last active
August 17, 2017 02:36
-
-
Save joeljacobs/c353d09fc13c001a7a9e34837ca104b7 to your computer and use it in GitHub Desktop.
Ridiculous docker ps format for Swarm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker ps --format 'table {{.ID}}|{{.Image}}|{{.Command}}|{{.RunningFor}}|{{.Status}}|{{.Ports}}|{{.Names}}'|sed -e 's/dev\.perfectpitchtech\.com:4567\/service\///' -e 's/\(^.*|.*|.*|.*|.*|\)\(.*\)\(|[^|]*$\)/\1+\2+\3/' -e 's/\(\|[a-z0-9]\{3\}[^\.]+\)\(\.[^|]\{4\}\)[^|]*$/\1\2\.\.\./'|(while read jerk; do ports=$(echo "$jerk"|sed 's/\(^.*+\)\(.*\)\(+.*$\)/\2/');newports=$(echo $ports|sed -e 's/\/[ut][dc]p\(,\)* */\1/g'|cut -c 1-12); echo $jerk|sed "s/+.*+/${newports}.../"; done)|column -tns "|" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment