0

I am using docker for different projects. When I run the command:

sudo docker images

It shows list of images with labels but there are a few images with no label or tag.

Here is a screenshot for reference

I want to know:

  1. What are these images with no label
  2. How to delete these images (as these are taking a large amount of space)
1
  • In all likelihood, these images are from incomplete builds (your docker build errored out, and Docker left the last completed stage so that you could debug if needed),
    – muru
    Apr 29, 2021 at 5:51

1 Answer 1

1

A Docker image with no label is sometimes referred to as a “dangling image”. These may be unused leftovers that have accumulated over time. You can remove any unused images all at once like this:

sudo docker image prune

You’ll get a standard message:

WARNING! This will remove all dangling images.
Are you sure you want to continue? [y/N]

Hit Y if you’re okay with the action.

To remove specific images, you can do this:

sudo docker image rm {image id}

You can remove multiple images by adding more IDs to the command. If any of the images are required by a container, then you’ll get a message like:

Error response from daemon: conflict: unable to remove repository reference "Fedora Workstation" (must force) - container cd20b396a061 is using its referenced image 75835a67d134
2
  • Thanks. It worked. Just a little confusion: Will it show the error message if that project is not up? Like if I have executed sudo docker-compose down and after that I try to remove a docker image.
    – Tayyab
    Apr 29, 2021 at 5:13
  • A container is separate from an image. So, if you are trying to remove an image that is required by any of your containers, then the message will appear 👍🏻
    – matigo
    Apr 29, 2021 at 5:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .