I’d add the -w
flag to grep
, to limit matches to words (or use ^<EXACT_NAME>$
), for otherwise <EXACT_NAME>
may still yield a partial match to another longer name? But like noted in an earlier answer:
So, without grep
, if for some reason one only wants the container name (which, of course, will simply match what is searched for, just like with the grep
example), this may suffice:
docker ps -a --format "{{.Names}}" --filter name=^/<EXACT_NAME>$
(Not sure about having multiples names for a single container?)