mirror of https://github.com/samply/bridgehead.git
Merge pull request #65 from samply/dont-delete-all-docker-images
Dont delete all docker images
This commit is contained in:
commit
dd4066d1a0
|
@ -66,11 +66,15 @@ case "$ACTION" in
|
|||
checkRequirements
|
||||
hc_send log "Bridgehead $PROJECT startup: Requirements checked out. Now starting bridgehead ..."
|
||||
export LDM_LOGIN=$(getLdmPassword)
|
||||
exec $COMPOSE -f ./$PROJECT/docker-compose.yml $OVERRIDE up --abort-on-container-exit
|
||||
exec $COMPOSE -p bridgehead-$PROJECT -f ./$PROJECT/docker-compose.yml $OVERRIDE up --abort-on-container-exit
|
||||
;;
|
||||
stop)
|
||||
loadVars
|
||||
exec $COMPOSE -f ./$PROJECT/docker-compose.yml $OVERRIDE down
|
||||
exec $COMPOSE -p bridgehead-$PROJECT -f ./$PROJECT/docker-compose.yml $OVERRIDE down
|
||||
;;
|
||||
is-running)
|
||||
bk_is_running
|
||||
exit $?
|
||||
;;
|
||||
update)
|
||||
loadVars
|
||||
|
|
|
@ -34,7 +34,7 @@ checkOwner(){
|
|||
}
|
||||
|
||||
printUsage() {
|
||||
echo "Usage: bridgehead start|stop|update|install|uninstall|enroll PROJECTNAME"
|
||||
echo "Usage: bridgehead start|stop|is-running|update|install|uninstall|enroll PROJECTNAME"
|
||||
echo "PROJECTNAME should be one of ccp|bbmri"
|
||||
}
|
||||
|
||||
|
@ -169,6 +169,17 @@ function retry {
|
|||
return 0
|
||||
}
|
||||
|
||||
function bk_is_running {
|
||||
detectCompose
|
||||
RUNNING="$($COMPOSE -p bridgehead-$PROJECT -f ./$PROJECT/docker-compose.yml $OVERRIDE ps -q)"
|
||||
NUMBEROFRUNNING=$(echo "$RUNNING" | wc -l)
|
||||
if [ $NUMBEROFRUNNING -ge 2 ]; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
##Setting Network properties
|
||||
# currently not needed
|
||||
#export HOSTIP=$(MSYS_NO_PATHCONV=1 docker run --rm --add-host=host.docker.internal:host-gateway ubuntu cat /etc/hosts | grep 'host.docker.internal' | awk '{print $1}');
|
||||
|
|
|
@ -4,10 +4,15 @@ source lib/functions.sh
|
|||
AUTO_HOUSEKEEPING=${AUTO_HOUSEKEEPING:-true}
|
||||
|
||||
if [ "$AUTO_HOUSEKEEPING" == "true" ]; then
|
||||
A="Performing automatic maintenance: Cleaning docker images."
|
||||
A="Performing automatic maintenance: "
|
||||
if bk_is_running; then
|
||||
A="$A Cleaning docker images."
|
||||
docker system prune -a -f
|
||||
else
|
||||
A="$A Not cleaning docker images since BK is not running."
|
||||
fi
|
||||
hc_send log "$A"
|
||||
log INFO "$A"
|
||||
docker system prune -a -f
|
||||
else
|
||||
log WARN "Automatic housekeeping disabled (variable AUTO_HOUSEKEEPING != \"true\")"
|
||||
fi
|
||||
|
|
Loading…
Reference in New Issue