If you ever developed with Docker, you have to acknowledge that it is great!
Ok… you have to wrap your brain around an additional layer with all those caveats we know and love (volumes, path in- and outside of containers, …), but it lets you bundle all your dependencies at build time and then ship an image that will run in every docker-compatible runtime!
When you develop with Docker and do a lot of start/stop/build actions you will inevitably clutter your Docker Host with many unused containers.
Here is how to get rid of them:
-
list all containers (running and stopped altogether)
docker ps -a
-
if there are too many of them (they are always too many!) run
docker rm $(docker ps -a -q)
-
the same trick applies to images (you maybe have to redownload some images after removing them)
- list images:
docker images
- remove them:
docker rmi $(docker images -a -q)
- list images: