I want to stop all containers that have dev1102in their name. There are several containers but I never know how many. So I run docker ps |grep -o 'dev1102_[A-Za-z\_]*' which lists me all containers I need. Output looks like this
dev1102_abc_de
dev1102_admin
dev1102_app_qqq
How can I pipe this output into a docker stop command, so all the listed containers from the grep get stopped?
I tried docker stop < docker ps |grep -o 'dev1102_[A-Za-z\_]*' but that results in a bash error:
-bash: docker: No such file or directory
docker stop $(docker ps | grep -o 'dev1102_[A-Za-z\_]*')should do the job!