<p>Due to some internal issues, we need to remove unused images as soon as they become unused.<br>
I do know it's possible to use <a href="https://kubernetes.io/docs/concepts/cluster-administration/kubelet-garbage-collection/" rel="nofollow noreferrer">Garbage collection</a> but it doesn't offer strict policy as we need. 
I've come across <a href="https://hub.docker.com/r/meltwater/docker-cleanup/" rel="nofollow noreferrer">this</a> solution but</p>

<ol>
<li>it's deprecated</li>
<li>it also removes containers and possible mounted volumes</li>
</ol>

<p>I was thinking about setting a <code>cron</code> job directly over the nodes to run <code>docker prune</code> but I hope there is a better way</p>

<p>No idea if it makes a difference but we are using AKS</p>

<p>This doesn't really accomplish much since things will be re-downloaded if they are requested again. But if you insist on a silly thing, best bet is a DaemonSet that runs with the host docker control socket hostPath-mounted in and runs <code>docker system prune</code> as you mentioned. You can't use a cron job so you need to write the loop yourself, probably just <code>bash -c 'while true; do docker system prune &amp;&amp; sleep 3600; done'</code> or something.</p>
