How can I fix this docker images cleanup script in my docker pipeline

  r/docker

Here is the script in my build stage, but the case is that on first build on commit, it fail on this script, but if I re-run this build stage, then it works.

 - script: | # Remove unused images from build server docker rmi -f $(docker images -f "dangling=true" -q) displayName: cleanup continueOnError: true 

Here is the error message I get on the first build:

"docker rmi" requires at least 1 argument. See 'docker rmi --help'. Usage: docker rmi [OPTIONS] IMAGE [IMAGE...] Remove one or more images ##[error]Bash exited with code '1'. Finishing: cleanup 

submitted by /u/exilen
[link] [comments]
Source: Reddit

LEAVE A COMMENT