DEV Community

Tek Kshetri
Tek Kshetri

Posted on

Docker remove all image, volume, container

Here I am going to write about removing docker images, volumes and containers. To do so, first of all, you need to shutdown the docker container.

docker-compose down
Enter fullscreen mode Exit fullscreen mode

After that, you can follow following method to remove required things,

# To remove all the containers
docker rm -f $(docker ps -a -q)

# To remove all the docker images
docker rmi -f $(docker images -a -q)

# To remove all the volumes
docker volume rm $(docker volume ls -q)

# To delete everything
docker system prune -a --volumes
Enter fullscreen mode Exit fullscreen mode

Top comments (1)

Collapse
 
polterguy profile image
Thomas Hansen

Cool trick :)