$ docker stop $(docker ps -a -q)
$ docker rm $(docker ps -a -q)
docker ps
. The argument -a/--all
include also the stopped ones and -q/--quiet
displays only the numeric IDs.docker stop
and docker rm
with the output of the first command (bash command substitution).References: