There is a new feature in Docker 1.13.x called Docker container prune: docker container prune This will do what you want and should work on all platforms the same way.
There is also a docker system prune: docker system prune, which will clean up containers, images, volumes, and networks all in one command.