This commit is contained in:
144 changed files with 20649 additions and 0 deletions

24
dnet.sh Executable file
View File

@@ -0,0 +1,24 @@
#!/bin/bash
if [ $# -eq 0 ]; then
nw=($(docker network ls | awk 'NR>=2 {printf "%s ",$2}'))
else
nw=$@
fi
echo ${nw[@]}
for network in ${nw[@]};do
docker network ls | grep $network 1>/dev/null 2>/dev/null
if [ $? -ne 0 ]; then
echo -e "\nNetwork $network not found!"
exit 1
fi
ids=$(docker network inspect $network | grep -E "^\s+\".{64}\"" | awk -F\" '{printf "%s ",substr($2,0,12)}')
echo -e "\nContainers in network $network:"
for id in ${ids[@]}; do
name=$(docker ps -a | grep $id | awk '{print $NF}')
echo -e "\t$id: $name"
done
shift
done