Can't delete Images with docker prune but with docker system prune and docker builder prune

Hello,

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

kind regards

You mean it showed something like the following:

untagged: mysql:latest
untagged: mysql@sha256:4ef30b2c11a3366d7bb9ad95c70c0782ae435df52d046553ed931621ea36ffa5
deleted: sha256:8e409b83ace60740ab0396735db367d86956b860af922e9e8e5116d9113714a7
deleted: sha256:d6af6c85faaeac31490463d441be8910d096140a0f16ba4e087af0e3486a4856
deleted: sha256:602f2bde624242ef392cca83bdf56117f3d91a975fd46d949493acba6a70aa66
deleted: sha256:ad72604a381078e5d14adf22909dadea11a29fa4a6bdb6a587491634bce03ae1
deleted: sha256:5d1706f3e231b7cd3f331d6e6bb292e67570465ed2323303da5b80f62e05fd31
deleted: sha256:23f7a3eb469dd3d3349b97b17458f0950af01998af170ee680c7b1bf7f08d702
deleted: sha256:626c71769b2577374ffc4f21218adedae6b65c19f28036e09243de4e38d1ef2b
deleted: sha256:16b97ea52390af38cd294625baecb296c162b2988ee846b84a9f06814110ccf8
deleted: sha256:793bf2f07c76320e58b21d571da958163ccb2131a8291a6dc0e1eeaa9f6c45e2
deleted: sha256:30c3fa05edb1433aa4e14c26e39120bbaaa90f7b2cf29084f031d21b158f779f
deleted: sha256:ddb5d3bfdbdd3ab961b874571c2aeb59565cf595d9fbcdedd0fd10571aaaa5a4

If not, a possible reason

docker image prune --help
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

docker version:

Engine:
  Version:          24.0.7
  API version:      1.43 (minimum version 1.12)
  Go version:       go1.20.10
  Git commit:       311b9ff
  Built:            Thu Oct 26 09:08:01 2023
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.6.26
  GitCommit:        3dd1e886e55dd695541fdcd67420c2888645a495
 runc:
  Version:          1.1.10
  GitCommit:        v1.1.10-0-g18a0cb0
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

docker info:

Client: Docker Engine - Community
 Version:    24.0.7
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.11.2
    Path:     /usr/libexec/docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  v2.21.0
    Path:     /usr/libexec/docker/cli-plugins/docker-compose
  scan: Docker Scan (Docker Inc.)
    Version:  v0.23.0
    Path:     /usr/libexec/docker/cli-plugins/docker-scan

Server:
 Containers: 0
  Running: 0
  Paused: 0
  Stopped: 0
 Images: 0
 Server Version: 24.0.7
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Using metacopy: false
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Cgroup Version: 1
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 3dd1e886e55dd695541fdcd67420c2888645a495
 runc version: v1.1.10-0-g18a0cb0
 init version: de40ad0
 Security Options:
  apparmor
  seccomp
   Profile: builtin
 Kernel Version: 5.4.0-169-generic
 Operating System: Ubuntu 20.04.6 LTS
 OSType: linux
 Architecture: x86_64
 CPUs: 2
 Total Memory: 7.729GiB
 Name: REMOVED
 ID: REMOVED
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Experimental: false
 Insecure Registries:
  REMOVED
 Live Restore Enabled: false

WARNING: No swap limit support

Thank You

i also have exactly same issue like you… Did you get any solution about that??