Merge pull request #36 from mag37/dev1
Fixes the Exclude-option to only exclude exact matches. Formatting: Added counter and info message on current update.
This commit is contained in:
@ -2,6 +2,7 @@
|
||||
<img src="extras/dockcheck_logo_by_booYah187.png" width="160" title="dockcheck">
|
||||
</p>
|
||||
<p align="center">
|
||||
<img src="https://img.shields.io/badge/coded%20by%20Human-100%25-yellow?style=flat-square" alt="No AI!">
|
||||
<img src="https://img.shields.io/badge/bash-4.3-green?style=flat-square&logo=gnubash" alt="bash">
|
||||
<a href="https://www.gnu.org/licenses/gpl-3.0.html"><img src="https://img.shields.io/badge/license-GPLv3-red?style=flat-square" alt="GPLv3"></a>
|
||||
<img src="https://img.shields.io/github/v/tag/mag37/dockcheck?style=flat-square&label=release" alt="release">
|
||||
@ -14,11 +15,8 @@
|
||||
<h4 align="center">With features like excluding specific containers, filter by name, auto-prune dangling images and more.</h4</h3>
|
||||
|
||||
|
||||
### :warning: URGENT! The 2.1 change had a breaking error - make sure you run an updated version.
|
||||
If you've had errors, inspect your containers and look for odd compose paths, volumes or ports.
|
||||
[errorCheck.sh](https://github.com/mag37/dockcheck/blob/main/errorCheck.sh) lists the important bits of each running container. If anything suspicious, recreate the container manually with `docker compose`.
|
||||
|
||||
### :pushpin: Recent changes:
|
||||
- **v0.2.4**: Fixed a bug with the Exclude-logic to only exclude exact matches. Added a counter.
|
||||
- **v0.2.3**: Added a self updating function (curl/git) and a ugly changenote-message for updates.
|
||||
- **v0.2.2**: Fixed breaking errors with multi-compose, odd breakage and working dir error.
|
||||
- **v0.2.1**: Added option to exclude a list of containers.
|
||||
|
18
dockcheck.sh
18
dockcheck.sh
@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
VERSION="v0.2.3"
|
||||
### ChangeNotes: Added self-updating git/curl-function and a dirty changenote.
|
||||
VERSION="v0.2.4"
|
||||
### ChangeNotes: Fixes to the Exclude-option to only exclude exact matches. +cleaning
|
||||
Github="https://github.com/mag37/dockcheck"
|
||||
RawUrl="https://raw.githubusercontent.com/mag37/dockcheck/main/dockcheck.sh"
|
||||
|
||||
@ -154,9 +154,17 @@ for i in "${GotUpdates[@]}"; do
|
||||
done
|
||||
}
|
||||
|
||||
### Listing typed exclusions:
|
||||
if [[ -n ${Excludes[*]} ]] ; then
|
||||
printf "\n\033[0;34mExcluding these names:\033[0m\n"
|
||||
printf "%s\n" "${Excludes[@]}"
|
||||
printf "\n"
|
||||
fi
|
||||
|
||||
### Check the image-hash of every running container VS the registry
|
||||
for i in $(docker ps --filter "name=$SearchName" --format '{{.Names}}') ; do
|
||||
[[ " ${Excludes[*]} " =~ ${i} ]] && continue; # Skip if the container is excluded
|
||||
### Looping every item over the list of excluded names and skipping:
|
||||
for e in "${Excludes[@]}" ; do [[ "$i" == "$e" ]] && continue 2 ; done
|
||||
printf ". "
|
||||
RepoUrl=$(docker inspect "$i" --format='{{.Config.Image}}')
|
||||
LocalHash=$(docker image inspect "$RepoUrl" --format '{{.RepoDigests}}')
|
||||
@ -200,8 +208,11 @@ if [ -n "$GotUpdates" ] ; then
|
||||
SelectedUpdates=( "${GotUpdates[@]}" )
|
||||
fi
|
||||
if [ "$UpdYes" == "${UpdYes#[Nn]}" ] ; then
|
||||
NumberofUpdates="${#SelectedUpdates[@]}"
|
||||
CurrentQue=0
|
||||
for i in "${SelectedUpdates[@]}"
|
||||
do
|
||||
((CurrentQue+=1))
|
||||
unset CompleteConfs
|
||||
ContPath=$(docker inspect "$i" --format '{{ index .Config.Labels "com.docker.compose.project.working_dir" }}')
|
||||
ContConfigFile=$(docker inspect "$i" --format '{{ index .Config.Labels "com.docker.compose.project.config_files" }}')
|
||||
@ -226,6 +237,7 @@ if [ -n "$GotUpdates" ] ; then
|
||||
fi
|
||||
### cd to the compose-file directory to account for people who use relative volumes, eg - ${PWD}/data:data
|
||||
cd "$ContPath" || { echo "Path error - skipping $i" ; continue ; }
|
||||
printf "\n\033[0;36mNow updating (%s/%s): \033[0;34m%s\033[0m\n" "$CurrentQue" "$NumberofUpdates" "$i"
|
||||
docker pull "$ContImage"
|
||||
### Reformat for multi-compose:
|
||||
IFS=',' read -r -a Confs <<< "$ComposeFile" ; unset IFS
|
||||
|
Reference in New Issue
Block a user