mirror of
https://github.com/mag37/dockcheck.git
synced 2026-02-14 23:38:15 +01:00
Update dockcheck.sh
added a check if there's any updates. changed order on listings.
This commit is contained in:
parent
72f00fdf9e
commit
07fe6ab9eb
1 changed files with 24 additions and 19 deletions
43
dockcheck.sh
43
dockcheck.sh
|
|
@ -42,27 +42,32 @@ printf ". "
|
||||||
done
|
done
|
||||||
|
|
||||||
### List what containers got updates or not
|
### List what containers got updates or not
|
||||||
if [ -n "$GotUpdates" ] ; then
|
|
||||||
printf "\n\033[31;1mContainers with updates available:\033[0m\n"
|
|
||||||
printf "%s\n" "${GotUpdates[@]}"
|
|
||||||
fi
|
|
||||||
if [ -n "$NoUpdates" ] ; then
|
if [ -n "$NoUpdates" ] ; then
|
||||||
printf "\n\033[32;1mContainers on latest version:\033[0m\n"
|
printf "\n\033[32;1mContainers on latest version:\033[0m\n"
|
||||||
printf "%s\n" "${NoUpdates[@]}"
|
printf "%s\n" "${NoUpdates[@]}"
|
||||||
fi
|
fi
|
||||||
|
if [ -n "$GotUpdates" ] ; then
|
||||||
### Optionally get updates
|
printf "\n\033[31;1mContainers with updates available:\033[0m\n"
|
||||||
printf "\n\033[36;1mDo you want to update? y/[n]\033[0m\n"
|
printf "%s\n" "${GotUpdates[@]}"
|
||||||
read UpdYes
|
|
||||||
if [ "$UpdYes" != "${UpdYes#[Yy]}" ] ; then
|
|
||||||
for i in "${GotUpdates[@]}"
|
|
||||||
do
|
|
||||||
# Check what compose-type is installed:
|
|
||||||
if docker compose &> /dev/null ; then DockerBin="docker compose" ; else DockerBin="docker-compose" ; fi
|
|
||||||
ContPath=$(docker inspect "$i" --format '{{ index .Config.Labels "com.docker.compose.project.working_dir"}}')
|
|
||||||
$DockerBin -f "$ContPath/docker-compose.yml" pull
|
|
||||||
$DockerBin -f "$ContPath/docker-compose.yml" up -d
|
|
||||||
done
|
|
||||||
else
|
|
||||||
printf "\nNo updates installed, exiting.\n"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
### Optionally get updates if there's any
|
||||||
|
if [ -n "$GotUpdates" ] ; then
|
||||||
|
printf "\n\033[36;1mDo you want to update? y/[n]\033[0m\n"
|
||||||
|
read UpdYes
|
||||||
|
if [ "$UpdYes" != "${UpdYes#[Yy]}" ] ; then
|
||||||
|
for i in "${GotUpdates[@]}"
|
||||||
|
do
|
||||||
|
# Check what compose-type is installed:
|
||||||
|
if docker compose &> /dev/null ; then DockerBin="docker compose" ; else DockerBin="docker-compose" ; fi
|
||||||
|
ContPath=$(docker inspect "$i" --format '{{ index .Config.Labels "com.docker.compose.project.working_dir"}}')
|
||||||
|
$DockerBin -f "$ContPath/docker-compose.yml" pull
|
||||||
|
$DockerBin -f "$ContPath/docker-compose.yml" up -d
|
||||||
|
done
|
||||||
|
else
|
||||||
|
printf "\nNo updates installed, exiting.\n"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
printf "\nNo updates available, exiting.\n"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue