mirror of
https://github.com/mag37/dockcheck.git
synced 2026-02-15 07:48:14 +01:00
renamed to not mix with the main script
This commit is contained in:
parent
a57c79e60f
commit
b5e2fcde1e
1 changed files with 1 additions and 1 deletions
|
|
@ -1,25 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
### Requires the regctl binary, either in PATH or as an alias
|
||||
### Get it here: https://github.com/regclient/regclient/releases
|
||||
|
||||
### Preferably placed in .bashrc or similar
|
||||
|
||||
### if regctl is not in PATH, set the alias:
|
||||
alias regctl="/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
|
||||
for i in $(docker ps --filter "name=$1" --format '{{.Names}}')
|
||||
do
|
||||
RepoUrl=$(docker inspect $i --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 for $i.\n" ; else printf "$i is already latest.\n" ; fi
|
||||
done
|
||||
fi
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue