Číst česky →

How to remove all Docker Containers and Images

1 min read Petr Pomajbík Linux Basics

How to stop all Docker Containers

docker kill $(docker ps -q)

How to remove all Docker Containers

docker rm $(docker ps -a -q)

How to remove all Docker Images

docker rmi -f $(docker images -q | sort -u)

Images with more than one tag are not removed without -f and their ID appears in the list repeatedly, hence sort -u.