diff --git a/README.md b/README.md index 3b0209e..b1d22ff 100644 --- a/README.md +++ b/README.md @@ -68,6 +68,7 @@ Options: -F Only compose up the specific container, not the whole compose stack (useful for master-compose structure). -h Print this Help. -i Inform - send a preconfigured notification. +-k N DaysKept - enable backups of images prior to update and prunes backups older than N days. -I Prints custom releasenote urls alongside each container with updates in CLI output (requires urls.list). -l Only include containers with label set. See readme. -m Monochrome mode, no printf colour codes and hides progress bar. @@ -245,6 +246,22 @@ The `urls.list` file is just an example and I'd gladly see that people contribut Pass `-x N` where N is number of subprocesses allowed, experiment in your environment to find a suitable max! Change the default value by editing the `MaxAsync=N` variable in `dockcheck.sh`. To disable the subprocess function set `MaxAsync=0`. +## Image Backups `-k` backup previous images as custom (retagged) images for easy rollback +When the option `DaysKept` is set **dockcheck** will store the image being updated as a backup, retagged with a different name and stored for the amount of days configured (*DaysKept*) before being pruned. +Let's say we're updating `b4bz/homer:latest` - then before replacing the current image it will be retagged with the name `dockcheck/homer:2025-10-26_1132_latest` +- `dockcheck` as repo name to not interfere with others. +- `homer` is the image. +- `2025-10-26_1132` is the time when running the script. +- `latest` is the tag of the image. + +Then if an update breaks, you could temporarily roll back to the previoius working state by changing the docker compose image to `image: dockcheck/homer:2025-10-26_1132_latest` and get it up and running again, then continue troubleshooting the breaking update. + +The backed up images will be removed if they're older than *DaysKept* value (passed as `-k N` or set in the `dockcheck.config` with `DaysKept=N`) and then pruned. +If configured for eg. 7 days, force earlier cleaning by just passing a lower number of days, eg. `-k 2` to clean everything older than 2 days. +Backed up images will not be removed if neither `-k` flag nor `DaysKept` config variable is set. + +The `docker images` or `docker image ls` commands will show all currently backed up images. +To manually remove any backed up images, do `docker rmi dockcheck/homer:2025-10-26_1132_latest`. ## Extra plugins and tools: diff --git a/default.config b/default.config index 2b5f75c..2289391 100644 --- a/default.config +++ b/default.config @@ -28,6 +28,7 @@ #CurlRetryCount=3 # Max number of curl retries #CurlConnectTimeout=5 # Time to wait for curl to establish a connection before failing #DisplaySourcedFiles=false # Display what files are being sourced/used +#DaysKept=7 # Enable backups of images and removes backups older than N days. ### Notify settings ## All commented values are examples only. Modify as needed. diff --git a/dockcheck.sh b/dockcheck.sh index 1a3ddd5..f9c68de 100755 --- a/dockcheck.sh +++ b/dockcheck.sh @@ -44,6 +44,7 @@ Help() { echo "-I Prints custom releasenote urls alongside each container with updates in CLI output (requires urls.list)." echo "-k N Number of days to store image backups before pruning - this also enables the backup function." echo "-l Only include containers with label set. See readme." + echo "-k N DaysKept - enable backups of images prior to update and prunes backups older than N days." echo "-m Monochrome mode, no printf colour codes and hides progress bar." echo "-M Prints custom releasenote urls as markdown (requires template support)." echo "-n No updates; only checking availability without interaction."