Compare commits

...

7 Commits

Author SHA1 Message Date
mag37
e864edc40e Update README.md 2023-03-01 21:02:55 +01:00
mag37
aac065022c urgent
Should not edit on production! Too stressful. Another mistake corrected.
2023-03-01 20:52:17 +01:00
mag37
3e60468d47 urgent
and another fix.
2023-03-01 20:43:06 +01:00
mag37
09c1b769ca urgent fix
too stressed.. typo
2023-03-01 20:39:02 +01:00
mag37
5392c48a57 URGENT
Added info about breakage.
2023-03-01 20:34:29 +01:00
mag37
cc72411de4 troubleshooting
Created for troubleshooting, use if you suspect dockcheck screwed up with errors to easily review your running configs. 
Restart the faulty contianer manually from the compose-file!
2023-03-01 20:27:47 +01:00
mag37
026d5296f8 urgent fix
Screwed up the array with compose-files! It just continued filling up on each loop, should be reset at each loop reset.
Will add info to readme.
2023-03-01 19:52:30 +01:00
3 changed files with 37 additions and 23 deletions

View File

@@ -1,6 +1,13 @@
# dockcheck # dockcheck
### A script checking updates for docker images **without pulling** - then selectively auto-update some/all containers. ### A script checking updates for docker images **without pulling** - then selectively auto-update some/all containers.
### :warning: URGENT!
The 2.0 change had a breaking error - compose-recreation might have included previous containers compose-file.
If you've had odd errors, you can use the [errorCheck.sh](https://github.com/mag37/dockcheck/blob/main/errorCheck.sh) script to list current running container configs in a readable way. Look especially for **Compose files** listed in wrong places.
Recreate the suspicious container(s) manually with `docker compose down && docker compose up -d`.
### :pushpin: Recent changes: ### :pushpin: Recent changes:
- **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. - **v0.2.1**: Added option to exclude a list of containers.
- **v0.2.1**: Added multi-compose support (eg. override). - **v0.2.1**: Added multi-compose support (eg. override).
- **v0.2.0**: Fixed error with container:tag definition. - **v0.2.0**: Fixed error with container:tag definition.
@@ -58,26 +65,6 @@ After the updates are complete, you'll get prompted if you'd like to prune dangl
`docker run` dont support using new images just by restarting a container. `docker run` dont support using new images just by restarting a container.
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.
### :beetle: Squashed Bugs:
- ~~No options for running without updates or auto update.~~
- ~~No filter to check only specific containers.~~
- ~~Faulty registry checkups stopped the updates completely.~~
- ~~No clear checks to skip containers producing errors.~~
- ~~Multi-digest images didn't correctly check with registry, giving false positives on updates.~~
- ~~Not working with filenames other than `docker-compose.yml`~~
- ~~Lists are not alphabetically sorted (due to stacks and other parameters)~~
- ~~Old `docker-compose` binary-check sometimes returned false error~~
- ~~Stacks gets updated as whole, even if only one service is chosen.~~
- ~~Path broken occationally (from inspect) - probably due to old docker-compose binary.~~
- ~~Script breaks if one of the chosen containers are a `docker run` container.~~
- ~~Using relative paths for volumes eg. `${PWD}/data:data` will create the volumes where you stand.~~
- ~~Having no curl/wget leads to corrupt `regctl` without alerting.~~
- ~~Using custom `.env` files does not work.~~
- ~~Pull not respecting image:tags, always defaulting to latest~~
- ~~Not respecting multi-compose projects using multiple `-f` like `...override.yml` or similar.~~
- ~~Not being able to exclude specific containers.~~
### :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.

View File

@@ -1,5 +1,5 @@
#!/usr/bin/env bash #!/usr/bin/env bash
VERSION="v0.2.1" VERSION="v0.2.2-URGENT"
Github="https://github.com/mag37/dockcheck" Github="https://github.com/mag37/dockcheck"
### Check if there's a new release of the script: ### Check if there's a new release of the script:
@@ -157,7 +157,8 @@ if [ -n "$GotUpdates" ] ; then
fi fi
if [ "$UpdYes" == "${UpdYes#[Nn]}" ] ; then if [ "$UpdYes" == "${UpdYes#[Nn]}" ] ; then
for i in "${SelectedUpdates[@]}" for i in "${SelectedUpdates[@]}"
do do
unset CompleteConfs
ContPath=$(docker inspect "$i" --format '{{ index .Config.Labels "com.docker.compose.project.working_dir" }}') 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" }}') ContConfigFile=$(docker inspect "$i" --format '{{ index .Config.Labels "com.docker.compose.project.config_files" }}')
ContName=$(docker inspect "$i" --format '{{ index .Config.Labels "com.docker.compose.service" }}') ContName=$(docker inspect "$i" --format '{{ index .Config.Labels "com.docker.compose.service" }}')
@@ -180,7 +181,7 @@ if [ -n "$GotUpdates" ] ; then
ComposeFile="$ContPath/$ContConfigFile" ComposeFile="$ContPath/$ContConfigFile"
fi fi
### cd to the compose-file directory to account for people who use relative volumes, eg - ${PWD}/data:data ### cd to the compose-file directory to account for people who use relative volumes, eg - ${PWD}/data:data
cd "$(dirname "${ComposeFile}")" || { echo "Path error - skipping $i" ; continue ; } cd "$ContPath" || { echo "Path error - skipping $i" ; continue ; }
docker pull "$ContImage" docker pull "$ContImage"
### Reformat for multi-compose: ### Reformat for multi-compose:
IFS=',' read -r -a Confs <<< "$ContConfigFile" ; unset IFS IFS=',' read -r -a Confs <<< "$ContConfigFile" ; unset IFS

26
errorCheck.sh Normal file
View File

@@ -0,0 +1,26 @@
#!/usr/bin/env bash
SearchName="$1"
for i in $(docker ps --filter "name=$SearchName" --format '{{.Names}}') ; do
echo "------------ $i ------------"
ContPath=$(docker inspect "$i" --format '{{ index .Config.Labels "com.docker.compose.project.working_dir" }}')
[ -z "$ContPath" ] && { "$i has no compose labels - skipping" ; continue ; }
ContConfigFile=$(docker inspect "$i" --format '{{ index .Config.Labels "com.docker.compose.project.config_files" }}')
ContName=$(docker inspect "$i" --format '{{ index .Config.Labels "com.docker.compose.service" }}')
ContEnv=$(docker inspect "$i" --format '{{index .Config.Labels "com.docker.compose.project.environment_file" }}')
ContImage=$(docker inspect "$i" --format='{{.Config.Image}}')
if [[ $ContConfigFile = '/'* ]] ; then
ComposeFile="$ContConfigFile"
else
ComposeFile="$ContPath/$ContConfigFile"
fi
echo -e "Service name:\t\t$ContName"
echo -e "Project working dir:\t$ContPath"
echo -e "Compose files:\t\t$ComposeFile"
echo -e "Container image:\t$ContImage"
echo
echo "Mounts:"
docker inspect -f '{{ range .Mounts }}{{ .Source }}:{{ .Destination }}{{ printf "\n" }}{{ end }}' $i
echo
done