mirror of
https://github.com/mag37/dockcheck.git
synced 2026-02-23 03:34:16 +01:00
Create dockcheck_function.sh
first commit
This commit is contained in:
parent
c1fbb4f0d2
commit
efb3eba337
1 changed files with 15 additions and 0 deletions
15
dockcheck_function.sh
Normal file
15
dockcheck_function.sh
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
### Requires the regctl binary, either in PATH or as an alias
|
||||||
|
### Get it here: https://github.com/regclient/regclient/releases
|
||||||
|
|
||||||
|
alias="/path/to/regctl"
|
||||||
|
dockcheck () {
|
||||||
|
if [[ -z "$1" ]]; then
|
||||||
|
echo "No container name given, here's the list of currently running containers:"
|
||||||
|
docker ps --format '{{.Names}}'
|
||||||
|
else
|
||||||
|
RepoUrl=$(docker inspect $1 --format='{{.Config.Image}}')
|
||||||
|
LocalHash=$(docker image inspect $RepoUrl --format '{{.RepoDigests}}' | sed -e 's/.*sha256/sha256/' -e 's/\]$//')
|
||||||
|
RegHash=$(regctl image digest --list $RepoUrl)
|
||||||
|
if [[ "$LocalHash" != "$RegHash" ]] ; then printf "Updates available.\n" ; else printf "Already latest.\n" ; fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue