Problem
In tools/docker-images/clp-package/build.sh
, the remove_temp_file_and_prev_image
function (called via EXIT trap) attempts to remove the previous image using docker image remove
. This can fail with a non-zero exit code if a running container is still referencing the image.
Since the script uses set -eu
, this failure causes the script to exit with an error code, which in turn causes subsequent commands in the caller (docker-images.yaml
taskfile) to fail execution (e.g., copying the unique image ID file into build/clp-package
).
Proposed Solutions
Either:
- Exit gracefully (with exit code 0) and print a warning message when image removal fails, or
- Have the caller (taskfile) gracefully handle the non-zero exit code
Context
Reported by @junhaoliao in PR #1335:
#1335 (comment)
Affected Files
tools/docker-images/clp-package/build.sh
docker-images.yaml
(taskfile caller)