There are more ways to use command output as arguments for other commands. The following three commands are all equivalent
docker rmi `docker images -qa`
docker rmi $(docker images -qa)
docker images -qa | xargs docker rmi
To keep the file short we will use only one. If you feel like typing the commands yourself, choose the one that seems faster to you
docker rmi $(docker images -qa)
docker images -q --filter dangling=true | xargs docker rmi
docker images |grep -v REPOSITORY|awk '{print $1}'|xargs -L1 docker pull
docker stop $(docker ps -q -n1)
docker stop `docker ps -q`
docker rm $(docker ps -aq)
# before
docker ps --before a1bz3768ez7g -q | xargs docker rm
# after
docker ps --since a1bz3768ez7g -q | xargs docker rm
docker ps -aq -f status=exited
docker stop docker ps -qa
docker rm docker ps -qa
docker rmi -f docker images -qa
docker volume rm $(docker volume ls -qf)
docker network rm docker network ls -q
docker ps -a docker images -a docker volume ls
docker network ls
{"mode":"full","isActive":false}
- Use
--rm
together withdocker build
to remove intermediary images during the build process.