Clean Docker Images which are older than x number of days

We have implemented Docker and Kubernetes in our environment. Recently we came up with the issue of space on our EC2 instances. We found that docker images which are exited are using more space on the instances. Hence, I thought of creating a script to clean up the Exited Images. I am able to get the script to clean up. However, I am unable to find the best way to schedule the script. Please suggest.