docker swiss army knife

Here are some useful docker calls, for when you're in the midst of developing with no time to remember the tricks.

  • Remove containers
    docker rm -f $(docker ps -a -q)

  • Remove images
    docker rmi -f $(docker images -a -q)

  • Same for volumes
    docker volume rm $(docker volume ls -q)

  • And for (the always useful) networks
    docker network rm $(docker network ls | tail -n+2 | awk '{if($2 !~ /bridge|none|host/){ print $1 }}')


For further information check https://github.com/moby/moby/issues/23371 and the docker documentation