I've seen many times the follwoing command to stop all docker containers:
docker stop $(docker ps -a -q)
There are two things that are not clear to me:
- docker ps -a prints all containers, not only running ones, so what is the point to stop containers that are already stopped?
- If docker ps returns/prints nothing (there are no running images) then docker stop blaims that it's not enough arguments.
What do I miss here? What is the best approach to cleanup an environment after docker?