Jon Gallant

Solution to "unknown shorthand flag a in -a" When Trying to Remove Docker Containers

1 min read

This docker command will remove all stopped containers.

Terminal window
docker rm $(docker ps -a -q)
```text
This docker command will remove all containers, even if they are running.
```bash
docker rm $(docker ps -a -q) -f
```text
If you run this command in a regular Windows Command prompt you will get the following output:
```bash
C:\>docker rm $(docker ps -a -q)
unknown shorthand flag: 'a' in -a
See 'docker rm --help'.

000298

The solution is to run this command in a PowerShell terminal or the Docker QuickStart Terminal.

000300 Jon

Share:
Share on X