mirror of
https://github.com/mag37/dockcheck.git
synced 2026-04-18 10:27:54 +00:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
132fda3388 | ||
|
|
cc9b3b0828 | ||
|
|
29c2c5e961 | ||
|
|
5dc9af9874 | ||
|
|
f91ca08d54 |
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
|
|
||||||
### :pushpin: Recent changes:
|
### :pushpin: Recent changes:
|
||||||
|
- **v0.2.5**: Added a new option `-s` to include stopped containers in the check for updates.
|
||||||
- **v0.2.4**: Fixed a bug with the Exclude-logic to only exclude exact matches. Added a counter.
|
- **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.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.2**: Fixed breaking errors with multi-compose, odd breakage and working dir error.
|
||||||
@@ -47,6 +48,7 @@ Options:
|
|||||||
-e Exclude containers, separated by comma.
|
-e Exclude containers, separated by comma.
|
||||||
-p Auto-Prune dangling images after update.
|
-p Auto-Prune dangling images after update.
|
||||||
-r Allow updating images for docker run, wont update the container.
|
-r Allow updating images for docker run, wont update the container.
|
||||||
|
-s Include stopped containers in the check. (Logic: docker ps -a).
|
||||||
```
|
```
|
||||||
|
|
||||||
Basic example:
|
Basic example:
|
||||||
@@ -76,8 +78,9 @@ After the updates are complete, you'll get prompted if you'd like to prune dangl
|
|||||||
Containers need to be manually stopped, removed and created again to run on the new image.
|
Containers need to be manually stopped, removed and created again to run on the new image.
|
||||||
|
|
||||||
### :hammer: Known issues
|
### :hammer: Known issues
|
||||||
- No detailed error feedback (just skip + list what's skipped) .
|
- No detailed error feedback (just skip + list what's skipped).
|
||||||
- Not respecting `--profile` options when re-creating the container.
|
- Not respecting `--profile` options when re-creating the container.
|
||||||
|
- Not working well with containers created by Portainer.
|
||||||
|
|
||||||
## `dc_brief.sh`
|
## `dc_brief.sh`
|
||||||
Just a brief, slimmed down version of the script to only print what containers got updates, no updates or errors.
|
Just a brief, slimmed down version of the script to only print what containers got updates, no updates or errors.
|
||||||
|
|||||||
11
dockcheck.sh
11
dockcheck.sh
@@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
VERSION="v0.2.4"
|
VERSION="v0.2.5"
|
||||||
### ChangeNotes: Fixes to the Exclude-option to only exclude exact matches. +cleaning
|
### ChangeNotes: Added an -s option to include stopped contianers in the check.
|
||||||
Github="https://github.com/mag37/dockcheck"
|
Github="https://github.com/mag37/dockcheck"
|
||||||
RawUrl="https://raw.githubusercontent.com/mag37/dockcheck/main/dockcheck.sh"
|
RawUrl="https://raw.githubusercontent.com/mag37/dockcheck/main/dockcheck.sh"
|
||||||
|
|
||||||
@@ -26,15 +26,18 @@ Help() {
|
|||||||
echo "-e Exclude containers, separated by comma."
|
echo "-e Exclude containers, separated by comma."
|
||||||
echo "-p Auto-Prune dangling images after update."
|
echo "-p Auto-Prune dangling images after update."
|
||||||
echo "-r Allow updating images for docker run, wont update the container"
|
echo "-r Allow updating images for docker run, wont update the container"
|
||||||
|
echo "-s Include stopped containers in the check. (Logic: docker ps -a)"
|
||||||
}
|
}
|
||||||
|
|
||||||
while getopts "aynprhe:" options; do
|
Stopped=""
|
||||||
|
while getopts "aynprhse:" options; do
|
||||||
case "${options}" in
|
case "${options}" in
|
||||||
a|y) UpdYes="yes" ;;
|
a|y) UpdYes="yes" ;;
|
||||||
n) UpdYes="no" ;;
|
n) UpdYes="no" ;;
|
||||||
r) DrUp="yes" ;;
|
r) DrUp="yes" ;;
|
||||||
p) PruneQ="yes" ;;
|
p) PruneQ="yes" ;;
|
||||||
e) Exclude=${OPTARG} ;;
|
e) Exclude=${OPTARG} ;;
|
||||||
|
s) Stopped="-a" ;;
|
||||||
h|*) Help ; exit 0 ;;
|
h|*) Help ; exit 0 ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
@@ -162,7 +165,7 @@ if [[ -n ${Excludes[*]} ]] ; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
### Check the image-hash of every running container VS the registry
|
### Check the image-hash of every running container VS the registry
|
||||||
for i in $(docker ps --filter "name=$SearchName" --format '{{.Names}}') ; do
|
for i in $(docker ps $Stopped --filter "name=$SearchName" --format '{{.Names}}') ; do
|
||||||
### Looping every item over the list of excluded names and skipping:
|
### Looping every item over the list of excluded names and skipping:
|
||||||
for e in "${Excludes[@]}" ; do [[ "$i" == "$e" ]] && continue 2 ; done
|
for e in "${Excludes[@]}" ; do [[ "$i" == "$e" ]] && continue 2 ; done
|
||||||
printf ". "
|
printf ". "
|
||||||
|
|||||||
Reference in New Issue
Block a user