1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Merge pull request #2102 from trapier/support-inspect-stopped-containers

support.sh: also inspect stopped containers
This commit is contained in:
Flavio Crisciani 2018-07-12 13:05:13 -07:00 committed by GitHub
commit 8b6cb7d59a

View file

@ -85,9 +85,10 @@ for networkID in $(${DOCKER} network ls --no-trunc --filter driver=overlay -q) "
done
echo "Container network configuration"
for containerID in $(${DOCKER} container ls -q); do
echo "ccc Container ${containerID}"
while read containerID status; do
echo "ccc Container ${containerID} state: ${status}"
${DOCKER} container inspect ${containerID} --format 'Name:{{json .Name | printf "%s\n"}}Id:{{json .Id | printf "%s\n"}}Hostname:{{json .Config.Hostname | printf "%s\n"}}CreatedAt:{{json .Created | printf "%s\n"}}State:{{json .State|printf "%s\n"}}RestartCount:{{json .RestartCount | printf "%s\n" }}Labels:{{json .Config.Labels | printf "%s\n"}}NetworkSettings:{{json .NetworkSettings}}' | sed '/^State:/ {s/\\"/QUOTE/g; s/,"Output":"[^"]*"//g;}'
if [ ${status} = "Up" ]; then
nspath=$(docker container inspect --format {{.NetworkSettings.SandboxKey}} ${containerID})
echo_and_run ${NSENTER} --net=${nspath[0]} ${IP} -o -4 address show
echo_and_run ${NSENTER} --net=${nspath[0]} ${IP} -4 route show
@ -95,11 +96,12 @@ for containerID in $(${DOCKER} container ls -q); do
echo_and_run ${NSENTER} --net=${nspath[0]} ${IPTABLES} -w1 -n -v -L -t nat | grep -v '^$'
echo_and_run ${NSENTER} --net=${nspath[0]} ${IPTABLES} -w1 -n -v -L -t mangle | grep -v '^$'
echo_and_run ${NSENTER} --net=${nspath[0]} ${IPVSADM} -l -n
printf "\n"
((containers++))
done
fi
printf "\n"
done < <(${DOCKER} container ls -a --format '{{.ID}} {{.Status}}' |cut -d' ' -f1,2)
echo -e "\n\n==SUMMARY=="
echo -e "\t Processed $networks networks"
echo -e "\t IP overlap found: $ip_overlap"
echo -e "\t Processed $containers containers"
echo -e "\t Processed $containers running containers"