|
|
|
@ -70,12 +70,14 @@ usage() {
|
|
|
|
|
|
|
|
|
|
case ${ACTION} in
|
|
|
|
|
"install")
|
|
|
|
|
get_image()
|
|
|
|
|
do_install_detail
|
|
|
|
|
;;
|
|
|
|
|
"upgrade")
|
|
|
|
|
docker-compose -f /opt/docker2/compose/nodered-app/docker-compose.yml up -d
|
|
|
|
|
;;
|
|
|
|
|
"rm")
|
|
|
|
|
APP_NAME="nodered"
|
|
|
|
|
IMAGE_NAME=$(uci get nodered.@nodered[0].image_name 2>/dev/null)
|
|
|
|
|
CONTAINER_IDS=$(docker ps -a --filter "ancestor=${APP_NAME}" --format '{{.ID}}')
|
|
|
|
|
echo "Stopping and removing containers..."
|
|
|
|
@ -86,16 +88,19 @@ case ${ACTION} in
|
|
|
|
|
docker rmi -f $IMAGE_NAME
|
|
|
|
|
;;
|
|
|
|
|
"start"|"stop"|"restart")
|
|
|
|
|
APP_NAME="nodered"
|
|
|
|
|
CONTAINER_IDS=$(docker ps -a --filter "ancestor=${APP_NAME}" --format '{{.ID}}')
|
|
|
|
|
for ID in $CONTAINER_IDS; do
|
|
|
|
|
docker ${ACTION} ${ID}
|
|
|
|
|
done
|
|
|
|
|
;;
|
|
|
|
|
"status")
|
|
|
|
|
APP_NAME="nodered"
|
|
|
|
|
CONTAINER_NAMES=$(docker ps -a --filter "ancestor=${APP_NAME}" --format '{{.Names}}')
|
|
|
|
|
docker ps --all -f "name=${CONTAINER_NAMES}" --format '{{.Status}}'
|
|
|
|
|
;;
|
|
|
|
|
"port")
|
|
|
|
|
APP_NAME="nodered"
|
|
|
|
|
CONTAINER_NAMES=$(docker ps -a --filter "ancestor=${APP_NAME}" --format '{{.Names}}')
|
|
|
|
|
docker ps --all -f "name=${CONTAINER_NAMES}" --format '{{.Ports}}' | grep -om1 '0.0.0.0:[0-9]*' | sed 's/0.0.0.0://'
|
|
|
|
|
;;
|
|
|
|
|