zsh alias to remove all docker containers returns command not found

Viewed 1690

I have this alias in my .zshrc file:

alias rmcons="docker rm -f $(docker ps -aq)"

But after trying to execute it, it removes only one container and then it prints

$rmcons
ef8197f147fb
zsh: command not found: c2ea2673f9e4
zsh: command not found: 4603059f1618
zsh: command not found: 40ad60328595

How can I remove all containers that docker ps -aq shows?

2 Answers
Related