title: how to delete unused docker images and containers automatically?
body: <p>is there a way to instruct docker swarm to automatically run garbage collection and remove all dangling images and containers? I run <code>docker stack rm STACK_NAME</code> and redeploy the stack but this keeps unused objects. I know I can run <a href="https://docs.docker.com/config/pruning/#prune-containers" rel="noreferrer">docker prune</a> to do the cleaning but is there a way to instruct docker to do so automatically? </p>
  
  <p>P.S I tried setting history retention limit according to this <a href="https://github.com/moby/moby/issues/24394" rel="noreferrer">post</a> </p>