Created
September 28, 2022 16:42
-
-
Save muratcakmaksoftware/da1500ae8130338b5bfc46dac4fb4211 to your computer and use it in GitHub Desktop.
docker ps format vertical sh
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
#!/bin/bash | |
install() { | |
echo "source $PWD/dockerps.sh;" >> ~/.bashrc | |
echo "added dockerps in ~/.bashrc;" | |
exec bash | |
echo "Successfully" | |
} | |
dock() { | |
CMD="$1" | |
if [[ $CMD == "ps" ]]; then | |
command docker ps --format="ID\t{{.ID}}\nNAME\t{{.Names}}\nPORTS\t{{.Ports}}\nIMAGE\t{{.Image}}\nSTATUS\t{{.Status}}\n" | |
elif [[ $CMD == "psd" ]]; then | |
command docker ps --format="ID\t{{.ID}}\nNAME\t{{.Names}}\nIMAGE\t{{.Image}}\nPORTS\t{{.Ports}}\nCOMMAND\t{{.Command}}\nCREATED\t{{.CreatedAt}}\nSTATUS\t{{.Status}}\n" | |
elif [[ $CMD == "psa" ]]; then | |
command docker ps --format="ID\t{{.ID}}\nNAME\t{{.Names}}\nIMAGE\t{{.Image}}\nPORTS\t{{.Ports}}\nNETWORK\t{{.Networks}}\nCOMMAND\t{{.Command}}\nCREATED\t{{.CreatedAt}}\nSTATUS\t{{.Status}}\n" | |
else | |
echo 'Options: dock ps (small), dock psd (detail), dock psa (all)' | |
fi | |
} | |
if [[ "$1" == install ]]; then | |
install | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment