Skip to content

Instantly share code, notes, and snippets.

@addeeandra
Created July 31, 2020 17:56
Show Gist options
  • Save addeeandra/9823f7fe191b4d4c06714d6e14e24a26 to your computer and use it in GitHub Desktop.
Save addeeandra/9823f7fe191b4d4c06714d6e14e24a26 to your computer and use it in GitHub Desktop.
Linux utility stuffs.
#/bin/bash
GREEN='\033[1;32m'
WHITE='\033[1;38m'
NC='\033[0m'
# Getting common docker information
# - Container(s) information
# - Default Network (bridge) information
# - Available Images(s) information
echo '---------------------------------------------'
echo -e "${GREEN}Container(s) info${NC}${WHITE}\n$(docker ps --format='> {{.Names}} [{{.Ports}}]')${NC}"
echo -e "$(docker ps -f status=exited --format='> {{.Names}} [EXITED]')"
echo '---------------------------------------------'
echo -e "${GREEN}Network (bridge) info${NC}\n${WHITE}$(docker network inspect bridge --format='{{range .Containers}}> {{.IPv4Address}}\t{{.Name}}{{"\n" -}}{{end}}')${NC}"
echo '---------------------------------------------'
echo -e "${GREEN}Available image(s)${NC}\n${WHITE}$(docker images --format='[{{.ID}}] {{.Repository}}:{{.Tag}}')${NC}"
echo '---------------------------------------------'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment