I know there are a lot of solutions for this, however if you need cross platform solution working both for for Windows and Linux OS, just use small and nifty sparrow plugin docker-remove-dangling-images:
$ sparrow plg install docker-remove-dangling-images
$ sparrow plg run docker-remove-dangling-images
Best
Alexey