If you would like to complete clean up the Docker containers, volumes and Networks on your Instance The steps are below, delete all the running docker container, images and volumes. the existing will not be running again and have to download the docker images and rebuild all the containers.
Stop all the running conainers,
docker stop $(docker ps -aq)
Then, remove all the conatainers,
docker rm $(docker ps -aq)
Prune system
docker system prune -a --volumes
Will remove all stopped containers, dangling images, dangling build cache and networks if not used by at least one container
docker rmi $(docker images -a -q)
Options:
docker images -a = List out all the images with an option -a
docker images -a -q = And delete them all with an option -q additionally
Comments (0)