Merge "Fix few small issues with dockerctl inspect"

This commit is contained in:
Jenkins 2015-10-06 10:20:19 +00:00 committed by Gerrit Code Review
commit 4fec63f8d0
2 changed files with 18 additions and 3 deletions

View File

@ -96,7 +96,7 @@ case "$1" in
shift
$cmd "$@" ;;
logs|inspect)
if [[ $container == 'all' ]]; then
if [[ $2 == 'all' ]]; then
echo "You need to specify valid container name."
echo "Use 'dockerctl list' to see available containers."
@ -104,7 +104,8 @@ case "$1" in
fi
cmd=$1
$cmd $container ;;
shift
$cmd "$@" ;;
*)
echo 'Invalid selection.'
show_usage

View File

@ -372,7 +372,21 @@ function logs {
}
function inspect {
${DOCKER} inspect ${CONTAINER_NAMES[$1]}
for container in $@; do
found="$(docker ps -a -q --filter="name=${CONTAINER_NAMES[$container]}" | wc -l)"
if [[ $? -ne 0 || $found -ne 1 ]]; then
echo "Could not find the $container container" 1>&2
if [[ $# -le 1 ]]; then
docker inspect
else
continue
fi
fi
${DOCKER} inspect ${CONTAINER_NAMES[$container]}
done
}
function restart_container {