To stop all docker containers


Use the combination of container stop and ps command, as shown here:
Code:
docker container stop $(docker ps -qa)
Warning! This will stop all containers

Let us look inside, how it works,
docker container stop <container-id> - this will stop the specified container ids.
docker ps -qa - this will list ids of all running containers

Now, Merging these two commands.
Code:
docker container stop $(docker ps -qa)

How to stop all docker containers?


[Image: docker-stop-all-containers-oneliner.gif]