Skip to content
Snippets Groups Projects
Commit 7fcd5f2d authored by Hahn Axel (hahn)'s avatar Hahn Axel (hahn)
Browse files

add --target option

parent af9ce687
Branches
No related tags found
1 merge request!241Docker checks
......@@ -6,6 +6,7 @@
# requirements:
# - docker
# - sudo permissions on docker command
# - jq
#
# ----------------------------------------------------------------------
# Cli docs:
......@@ -15,13 +16,14 @@
# 2024-01-22 v1.1 <axel.hahn@unibe.ch> detect DOCKER; use sudo; add debug
# 2024-01-23 v1.2 <axel.hahn@unibe.ch> Show a list of docker containers; add path
# 2024-01-24 v1.3 <axel.hahn@unibe.ch> remove emoji icons; handle "null" in license info; show rootless or not
# 2024-01-29 v1.4 <axel.hahn@unibe.ch> add --target option
# ======================================================================
. $(dirname $0)/inc_pluginfunctions
. $(dirname $0)/inc_dockerfunctions.sh
self_APPVERSION=1.3
self_APPVERSION=1.4
# ----------------------------------------------------------------------
# FUNCTIONS
......@@ -50,11 +52,20 @@ USAGE:
$_self [OPTIONS]
OPTIONS:
General:
-h, --help this help
-c, --containers Flag: Show containers (slow)
-e, --errors Flag: Show containers on error only (slow)
-d, --debug Debug; Flag: show all docker system infos
Connect to docker:
-p, --path Custom directory for docker binary
-t, --target Custom docker target; value for DOCKER_HOST
Needed only if Docker does not run on a unix socket or
multiple users run a rootless docker daemon.
Flags:
-c, --containers Flag: Show containers (slow)
-e, --errors Flag: Show containers on error only (slow)
EXAMPLES:
$_self
......@@ -95,7 +106,8 @@ while [[ "$#" -gt 0 ]]; do case $1 in
PATH="$2:$PATH";
fi
shift; shift;;
*) echo "ERROR: Unknown parameter: $1"; showHelp; exit 1;
-t|--target) export DOCKER_HOST="$2"; shift; shift;;
*) echo "ERROR: Unknown parameter: $1"; _showHelp; exit 1;
esac; done
......@@ -107,7 +119,7 @@ _detectDockerenv
# --- get data
data=$( sudo -n --preserve-env docker system info --format '{{ json . }}' )
_detectDockererror "$data"
_detectDockererror "$data" 1
typeset -i iCTotal;
iCTotal=$( _getString "$data" ".Containers" )
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment