For the docker ps command, the -a flag includes inactive containers and the -q flag suppress all output except for the container ID.
docker container prune
docker ps -aq --filter "status=exited" | xargs docker rm -f
More on filtering: https://docs.docker.com/engine/reference/commandline/ps/#filtering
(Created = Created but not successfully started: https://stackoverflow.com/a/43734669/38408)
docker ps -aq --filter "status=created" | xargs docker rm -f
The equal operator wildcards by default. For an exact match, the value should be framed as ^/string$
.
docker ps -aq --filter "name=^/projectname"
docker ps -aq --filter "label=outrigger.project=projectname" | xargs docker rm
docker image prune
docker image ls | egrep "GB$" | awk '{ print $3 }' | xargs docker image rm -f