diff --git a/README.md b/README.md index d8f6618..7170cce 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,7 @@

+ No AI! bash GPLv3 release @@ -14,11 +15,8 @@

With features like excluding specific containers, filter by name, auto-prune dangling images and more. -### :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. diff --git a/dockcheck.sh b/dockcheck.sh index c7ae908..8726f2b 100755 --- a/dockcheck.sh +++ b/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