I have a named container that may or may not be up and if it is up I want to be able to kill all the containers but that one by name. Basically what I want is:
docker kill $(docker ps -aq --filter="name!=<container-name>")
sadly the internal docker ps command here raises the error:
Error response from daemon: Invalid filter 'name!'
I tried getting a similar result using grep -v:
docker kill $(docker ps -q | grep -v $( docker ps -q -f name=<container-name>))
The problem is that if the container is not up (which very well may be) then the "docker ps -q -f name=" returns nothing and grep doesn't work with no pattern so this entire thing fails.
Any suggestions?