Create websites with TailwindCSS
Start building the next great SAAS
Alpine & Tailwind UI Library
Plug'n Play Authentication for Laravel
Create website designs with AI
Blog platform for developers
Build a simple static website
21-day program to build a SAAS
docker stop $(docker ps -a -q)
docker rm $(docker ps -a -q)
Recently I've been learning about Docker and Containers. In the process of learning this resulted in creating a bunch of containers and then shutting them all down one-by-one. And if I had 30 containers, this could take quite awhile.
Instead of wasting my time shutting them down and removing them one by one, I needed a way to stop all the containers and then remove them. If you are in need of the same functionality, simply run the following 2 commands:
docker stop $(docker ps -a -q)
docker rm $(docker ps -a -q)
Now, if you were to run docker ps -a
you will no longer see any more containers and you can start off with a clean slate :)
Here is what the above code is doing:
1. It first stops all the running containers and then removes them.
2. It then removes all the stopped containers.
3. Finally it removes all the dangling images.