prune
$ docker system prune --all
WARNING! This will remove:
- all stopped containers
- all networks not used by at least one container
- all dangling images
- all build cache
Are you sure you want to continue? [y/N] y
# prune volume only
$ docker system prune --volumes
show info
[!NOTE|label:see also:]
$ docker system df
docker rmi
remove via docker image
$ docker rmi -f $(docker images "*/*/*/myimage" --format "{{.ID}}")
or
$ docker images "*/*/*/myimage" --format "{{.ID}}" | xargs docker rmi -f
-
$ docker images -q -f "dangling=true" | xargs docker rmi -f --no-trunc
or
$ docker rmi -f $(docker images --filter dangling=true -q)
-
$ docker image prune --filter="dangling=true"
docker rmi for keywords
$ name='jenkins'
$ tag='2.361.3-lts'
$ if docker images ${name}:${tag} --format \"{{.Tag}}\" >/dev/null ; then
for imageId in $(docker images ${name} --format \"{{.Tag}}\\t{{.ID}}\" |
grep --color=none --fixed-strings ${tag} |
awk '{print \$NF}' |
uniq);
do
docker rmi ${name}:${tag} ;
docker rmi -f ${imageId} ;
done ;
fi
- cleanup all image path with
my.artifactory.com/docker/marslo/
$ docker rmi -f $(docker images my.artifactory.com/docker/marslo/* -q)
- or
$ docker rmi -f $(docker images my.artifactory.com/docker/*/* -q)
- or
docker rm
-
$ docker ps --filter "status=exited" --format '{{.ID}}' | xargs docker rm -f
- or
$ docker rm $(docker ps -aq --filter "status=exited")
- or