I want to remove all containers
docker rm -f $(docker ps -aq)
or docker rm $(docker ps -a -q)
I'm getting the following message
unknown shorthand flag: 'a' in -a See 'docker rm --help'.
Try this one:
docker rm -f $(docker ps -a -q)
$() is not Windows syntax. Would probably work on Linux and Mac but not on windows. Therefore it would be better to use docker only command - prune. So to remove all stopped containers you can do:
$()
prune
docker container prune
More info can be found at this answer