Hacker News new | ask | show | jobs
by willemmali 3432 days ago
Like this?

docker rmi -af

I'm a bit confused by the backticks as I use them all the time scripting, but also in Markdown.

1 comments

I have a gist for it: https://gist.github.com/pubkey/73dcb894cf5f7d262863

#stop and delete all containers

docker rm -f $(docker ps -a -q)

#delete all images

docker rmi -f $(docker images -q)

This is NOT equivalent. The OP was talking about removing unused images. Your commands remove all images.
Maybe this?

    docker rm $(docker ps -qa --no-trunc --filter "status=exited")
    docker rmi $(docker images --filter "dangling=true" -q --no-trunc)
fwiw, there's a new syntax for this, that is a bit more verbose, but probably worth adopting:

docker container rm $(docker container ls -qa)

docker image rm $(docker image ls -q)