1

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'.
Nursultan
  • 35
  • 4

2 Answers2

0

Try this one:

 docker rm -f $(docker ps -a -q)
Augusto Pohl
  • 133
  • 1
  • 7
0

$() 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:

docker container prune

More info can be found at this answer

The Hog
  • 889
  • 10
  • 26