Docker images <none>
1 min readApr 7, 2018
- Docker’s intermediate images maintenance. These are the “<none> <none>” images located in docker images -a only (these won’t show up in
docker images
. These can’t really be cleaned up since they are attached to working containers. Why? It is because for each Dockerfile step, a new hash is made for intermediate layers that increase reusability, decrease disk usage, and speed up docker builds by allowing each step to be cached. So, in conclusion, it is fine to ignore these unless it is really that bothersome (look up reducing your steps but this would require a longer build time, this is a trade-off decision that is really up to whoever is in charge of code base). - Dangling docker images. These are the “<none> <none>” you see when you type
docker images
. You can usedocker rmi $(docker images -f “dangling=true" -q)
to clean these up.docker images -f “dangling=true" -q
shows you all of the dangling images and rmi will remove all of them. Unfortunately, with this code, it return an error if you do not have any dangling images and would need another condition to do nothing. A solution would be to usedocker images prune -a
instead (only works fordocker version
above 1.25). Check intodocker system prune
if you are using multiple containers, volumes and networks.