I wanted to clean up space after building docker images in an azure pipeline docker image prune -a listed deleted images but at the end showd ‘Total reclaimed space: 0B’ however docker system prune and docker builder prune worked as expected. I do not understand why in this case docke image prune does not work. Any Ideas
Usage: docker image prune [OPTIONS]
Remove unused images
Options:
-a, --all Remove all unused images, not just dangling ones
--filter filter Provide filter values (e.g. "until=<timestamp>")
-f, --force Do not prompt for confirmation
Without passing --all, it will just remove dangling images, not all unused images.
yes the output showed that the images got delted and/or untagged however the total reclaimed space was 0B with sudo docker image prune -a I got the same output.
Please, share the output of the following commands:
docker info
docker version
I helped someone recently who installed Docker on a not supported operating system, and Docker Compose could create containers, but could not remove them. I had to download the latest version of docker compose from github, and that worked perfectly. The above commands can show the version numbers and some parameters. Before you share the outputs, check if you can find any IP address or value that you wouldn’t share and replce it with “REMOVED”. When you share the output, do it in code block as I did. You can find the formatting guide here: How to format your forum posts
That is maintained by the distribution maintainers and the official documentation of Docker starts with the command to remove it. That package is supported by the maintainers of the distribution.
Since you opened the topic I had to realize that when you delete an image you built, it goes to the build cache. So when you run docker system df you see the size of the sum of images decrease, and at the same time the size of the cache increase. Since docker system prune and docker builder prune can delete the cache, but docker image prune deletes only images, it could explain why you didn’t see reclaimed space.
thank you know I understand, but just out of curiosity is this also the expected/wanted behavior? Because I expected that an image prune removes the Image and its layers etc. just like system prune behaves on the system level.
I guess when you build the image, it is already used as a cache for new builds, so it is just not shown twice, but when you delete the image, it has to appear in the cache size. If you think it is confusing, you can try to recommend something in the Roadmap
For example docker image prune could show a warning about it.