+91 700 483 5930   +91 810 584 3520    info@scmgalaxy.com
LOGIN
Sign In or Register
Avatar
Not Registered Yet?

Join Now! It's FREE. Get full access and benefit from this site

Reset My password - Remind Me My username

Username
Password
Remember me
 
scmGalaxy logo

Docker Commands line Reference

One liner to stop all of Docker containers:
> docker stop $(docker ps -a -q)
 
One liner to remove all of Docker containers:
> docker rm $(docker ps -a -q)
OR
> docker rm $(docker images -q)
OR
> docker rmi $(docker images -q)
 
 
In case of error message Get http:///var/run/docker.sock/v1.14/containers/json?all=1: dial unix /var/run/docker.sock: permission denied
> sudo docker rm $(sudo docker ps -a -q)
 
 
To only stop exited containers and delete only non-tagged images.:
> docker ps --filter 'status=Exited' -a | xargs docker stop
> docker images --filter "dangling=true" -q | xargs docker rmi 
 
Remove all containers that aren't currently running: 
> docker rm $(docker ps -a -q -f "status=exited*")
 
if not the volumes will not be delete !!! (like if you are using a mysql docker image) and all the volumes will be orphans !
> sudo docker rm -f -v $(sudo docker ps -a -q)
Rate this item
(0 votes)
Rajesh Kumar

.

Total, Over 12 years of extensive experience in the Software Configuration Management domain having depth knowledge of DevOps, Continuous Integration and Delivery, Configuration Management, Build and Installer, Release Management and Application Management.

NEW TUTORIALS