Switch to docker image prune
In general docker image prune
should fulfill the same
role as our older docker rmi $(docker images -q -f dangling=true)
command.
Docker prune normally lists the images it is going to remove & prompt the user to agree.
With the --force flag, we skip the prompt.
Default behaviour is to delete all the dangling images. Those are images that are untagged & not used by any container.
However, as we push specific versions to production, we are not likely to have untagged images (a version 1.16.2 will not untag a version 1.16.1) we need to handle also tagged images that are no longer in use by any of the containers.