[ad_1]
In this TechRepublic How to Make Tech Work video, Jack Wallen reveals how you can cease and take away all Docker containers directly with simply two easy instructions.
I can’t let you know what number of instances I’ve had approach too many Docker containers operating and wished to simply blow all of them away and begin over. Granted, I wouldn’t do that on a manufacturing machine; however in the event you’re engaged on a improvement surroundings the place it doesn’t matter in the event you kill each operating container, then utilizing this nuclear choice is an efficient strategy to go.
For occasion, you may have to deploy a brand new testing container on a port that another check container is utilizing. Instead of monitoring that container down – and so long as you don’t want some other container to remain operating – there’s a a lot simpler answer for this. What I’m about to point out you does precisely what it appears like.
The first command will cease all operating containers, and the second command deletes them. It works each time. Here’s the way you do it.
To cease your whole operating Docker containers, subject the command docker cease $(docker ps -a -q). The subsequent command removes all containers, which is docker take away $(docker ps -a -q).
As you’ll be able to see, there are two instructions: docker take away (or cease) and docker ps -a -q. The first command makes use of the output of the second command as a variable, so if in case you have a number of containers operating, it’ll both cease or take away them unexpectedly. This command is available in very useful, although bear in mind to make use of it properly. If you’ve any containers operating that should stay up, you’re higher off stopping and eradicating the containers manually.
Subscribe to TechRepublic’s How To Make Tech Work on YouTube for all the most recent tech recommendation for enterprise execs from Jack Wallen.
