Learn Docker With My Newest Course

Dive into Docker takes you from "What is Docker?" to confidently applying Docker to your own projects. It's packed with best practices and examples. Start Learning Docker →

Docker Tip #31: How to Remove Dangling Docker Images


If you're working with Docker, you've probably noticed a lot of none references when you list your images. Here's how to clean them up.

If you’ve ever ran a docker image ls you’ve likely noticed 1 or more items that have a <none> repository and a <none> tag.

A dangling image example:
REPOSITORY                 TAG                 IMAGE ID            CREATED             SIZE
<none>                     <none>              7848fcc70e7b        4 days ago          362MB

Dangling images are not referenced by other images and are safe to delete. If you have a lot of them, it can be really tedious to remove them, but lucky for us Docker has a few commands to help us eliminate dangling images.

In older versions of Docker (and this still works today), you can delete dangling images on their own by running docker rmi -f $(docker images -f "dangling=true" -q).

But with newer versions of Docker (1.13+) there’s an even better command called docker system prune which will not only remove dangling images but it will also remove all stopped containers, all networks not used by at least 1 container, all dangling images and build caches.

This is something you should run on a regular basis. I personally run it on a daily cron job on both my development machine and production boxes.

Free Intro to Docker Email Course

Over 5 days you'll get 1 email per day that includes video and text from the premium Dive Into Docker course. By the end of the 5 days you'll have hands on experience using Docker to serve a website.