-
-
Save beeman/aca41f3ebd2bf5efbd9d7fef09eac54d to your computer and use it in GitHub Desktop.
# Stop all containers | |
docker stop `docker ps -qa` | |
# Remove all containers | |
docker rm `docker ps -qa` | |
# Remove all images | |
docker rmi -f `docker images -qa ` | |
# Remove all volumes | |
docker volume rm $(docker volume ls -qf) | |
# Remove all networks | |
docker network rm `docker network ls -q` | |
# Your installation should now be all fresh and clean. | |
# The following commands should not output any items: | |
# docker ps -a | |
# docker images -a | |
# docker volume ls | |
# The following command show only show the default networks: | |
# docker network ls | |
Hey this line $(...) doesn't work with fish. Is there an alternative that works everywhere?
Just drop the $, at least for that bit of fish. Or just run bash and then paste in the command.
Here's the fish
version for clarity.
docker stop (docker ps -qa);
docker rm (docker ps -qa);
docker rmi -f (docker images -qa);
docker volume rm (docker volume ls -q);
docker network rm (docker network ls -q);
Hi, I tried docker volume rm $(docker volume ls -qf)
to remove volumes but got the following message returned:
`flag needs an argument: 'f' in -f
See 'docker volume ls --help'.
"docker volume rm" requires at least 1 argument.
See 'docker volume rm --help'.
Usage: docker volume rm [OPTIONS] VOLUME [VOLUME...]
Remove one or more volumes`
I tried this instead and successfully removed all volumes:
docker volume rm $(docker volume ls -q)
After these commands I still had volumes under docker volume ls
had to run docker volume prune
to remove them. Reclaimed almost half a gig!
thanks
You have a typo, it should be:
docker system prune --volumes --all
(note pluralvolumes
)Try this 👍
docker stop `docker ps -qa` docker system prune --volume --all
This is actually plural now --volumes
thanks!!!
Thanks
<3
This is missing:
docker builder prune
** The backtick syntax should be replaced with $()
docker stop $(docker ps -qa)
docker system prune -a
that's all you need to remove everything