- Create script
nano dockerimageprune.sh
#!/bin/bash
docker image prune -a -f
chmod +x dockerimageprune.sh
- Create crontab
crontab -e
## This is example if we want to execute scipt every minute. For design crontab you can goes to this [web](https://crontab-generator.org/).
* * * * * bash /root/dockerimageprune.sh >/dev/null 2>&1