exit and delete all but the latest docker container
I was wondering if there was a way to exit and delete all of them except for the latest one ?
One Solution collect form web for “exit and delete all but the latest docker container”
A quick approach to do this is the following:
First, stop all containers with this command:
docker stop $(docker ps -aq)
Then, start the container that you want to keep using:
docker start container_name
And finally, use docker container prune, which removes all stopped containers.
docker container prune