I am looking at setting up the following command as a cron job. The purpose of this command is to remove old containers that are no longer needed by Discourse. It will automatically manage my docker space consumption.
docker images --quiet --filter=dangling=true | xargs --no-run-if-empty docker rmi
The filter will only list docker images listed as <none> <none>
. Then it will delete the images. This is set up to be run silently without human interaction.
As anyone else done this? Any gotchas or oh crap moments I need to be aware of?
or is there a better way?