feature(helpers): add container status display
This commit is contained in:
parent
2b583ad7e0
commit
810cbd44b7
@ -25,6 +25,7 @@ fi
|
|||||||
|
|
||||||
### parameter defaults
|
### parameter defaults
|
||||||
doShell=false
|
doShell=false
|
||||||
|
doStatus=false
|
||||||
container_name="ab-nginx"
|
container_name="ab-nginx"
|
||||||
NETWORK='nginx_network'
|
NETWORK='nginx_network'
|
||||||
SUBNET='172.31.254.0/24'
|
SUBNET='172.31.254.0/24'
|
||||||
@ -71,6 +72,9 @@ scriptHelp() {
|
|||||||
newline
|
newline
|
||||||
textBlockParam '-s|--shell' 'off: run in detached mode'
|
textBlockParam '-s|--shell' 'off: run in detached mode'
|
||||||
textBlock "Enter the container using an interactive ASH/BusyBox shell. This happens after startup operations but *before* nginx is actually started. This is a great way to see configuration changes possibly stopping nginx from starting normally."
|
textBlock "Enter the container using an interactive ASH/BusyBox shell. This happens after startup operations but *before* nginx is actually started. This is a great way to see configuration changes possibly stopping nginx from starting normally."
|
||||||
|
newline
|
||||||
|
textBlockParam '--status'
|
||||||
|
textBlock "Run a search for all AB-NGINX containers and display their name and status."
|
||||||
printf "%s" "$yellow"
|
printf "%s" "$yellow"
|
||||||
newline
|
newline
|
||||||
textBlock"More information can be found at: https://git.asifbacchus.dev/ab-docker/ab-nginx/wiki"
|
textBlock"More information can be found at: https://git.asifbacchus.dev/ab-docker/ab-nginx/wiki"
|
||||||
@ -185,6 +189,10 @@ while [ $# -gt 0 ]; do
|
|||||||
container_name="$2"
|
container_name="$2"
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
|
--status)
|
||||||
|
# find containers and check their status
|
||||||
|
doStatus=true
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
printf "%s\nUnknown option: %s\n" "$err" "$1"
|
printf "%s\nUnknown option: %s\n" "$err" "$1"
|
||||||
printf "Use '--help' for valid options.\n\n%s" "$norm"
|
printf "Use '--help' for valid options.\n\n%s" "$norm"
|
||||||
@ -194,6 +202,15 @@ while [ $# -gt 0 ]; do
|
|||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
|
|
||||||
|
#
|
||||||
|
# status check
|
||||||
|
if [ "$doStatus" = "true" ]; then
|
||||||
|
printf "\nFound the following AB-NGINX containers:\n"
|
||||||
|
docker ps -a --filter "label=dev.asifbacchus.docker.internalName=ab-nginx"
|
||||||
|
printf "\n"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
# create network if it doesn't already exist
|
# create network if it doesn't already exist
|
||||||
docker network inspect ${NETWORK} >/dev/null 2>&1 ||
|
docker network inspect ${NETWORK} >/dev/null 2>&1 ||
|
||||||
docker network create \
|
docker network create \
|
||||||
|
Loading…
Reference in New Issue
Block a user