unknown shorthand flag: 'a' in -a in docker

Viewed 3499

I'm trying to remove all the docker images using the following command:

docker rmi $(docker images -a -q)

This fails with the error:

C:\Users\Nithi>docker rmi $(docker images -a -q)
unknown shorthand flag: 'a' in -a
See 'docker rmi --help'.

This is on a Windows 10 machine.

1 Answers

You are using the old Windows command line (CMD), which does not support the $() syntax. You can run this command in PowerShell instead, which does support the syntax.

To switch to PowerShell, run the command powershell in CMD, or search "powershell" in the start menu. You can tell that you're running PowerShell by the prompt now beginning with the letters PS.

Related