1. 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).
  2. Dangling docker images. These are the “<none> <none>” you see when you type docker images. You can use docker 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 use docker images prune -a instead (only works for docker version above 1.25). Check into docker system prune if you are using multiple containers, volumes and networks.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store