====== Docker - Images - Remove dangling images ======
Docker images consist of multiple layers.
Dangling images are layers that have no relationship to any tagged images.
* They no longer serve a purpose and consume disk space.
* They can be located by adding the filter flag, **-f** with a value of **dangling=true** to the docker images command.
* When you're sure you want to delete them, you can add the **-q** flag, then pass their ID to docker rmi:
----
To list dangling images:
docker images -f dangling=true
----
To remove dangling images:
docker rmi $(docker images -f dangling=true -q)
or
docker rmi $(docker images --filter "dangling=true" -q --no-trunc)
----
An alternative to listing dangling images:
docker images | awk '// { print $3 }'
----