Skip to content

podman images --filter dangling=false showing dangling images #26019

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
heitorPB opened this issue Apr 29, 2025 · 6 comments
Closed

podman images --filter dangling=false showing dangling images #26019

heitorPB opened this issue Apr 29, 2025 · 6 comments
Labels
kind/bug Categorizes issue or PR as related to a bug. triaged Issue has been triaged

Comments

@heitorPB
Copy link

Issue Description

`podman image ls --filter "dangling=false" lists dangling image.

Steps to reproduce the issue

Steps to reproduce the issue:

$ podman image ls --filter "dangling=true"
REPOSITORY  TAG         IMAGE ID    CREATED     SIZE

$ podman image ls --filter "dangling=false" | grep postgres
docker.io/library/postgres                                         latest                        563071385448  2 months ago   446 MB
docker.io/library/postgres                                         <none>                        9a0ce6be5dd4  5 months ago   442 MB
docker.io/library/postgres                                         16.3-alpine                   01100f48660a  10 months ago  248 MB
docker.io/library/postgres                                         15.1-alpine                   f8428074961e  2 years ago    246 MB

Describe the results you received

The filter dangling=false has no effect and shows images with <none> tag.

Describe the results you expected

I'd expect no image with <none> tag.

podman info output

$ podman info
host:
  arch: amd64
  buildahVersion: 1.39.2
  cgroupControllers:
  - cpu
  - io
  - memory
  - pids
  cgroupManager: systemd
  cgroupVersion: v2
  conmon:
    package: Unknown
    path: /nix/store/cxp3gdx9kqksqsrvdxga6k0q2jyhw9x9-podman-helper-binary-wrapper/bin/conmon
    version: 'conmon version 2.1.13, commit: '
  cpuUtilization:
    idlePercent: 95.64
    systemPercent: 1.63
    userPercent: 2.73
  cpus: 16
  databaseBackend: sqlite
  distribution:
    codename: warbler
    distribution: nixos
    version: "25.05"
  eventLogger: journald
  freeLocks: 2046
  hostname: L14
  idMappings:
    gidmap:
    - container_id: 0
      host_id: 100
      size: 1
    - container_id: 1
      host_id: 100000
      size: 65536
    uidmap:
    - container_id: 0
      host_id: 1000
      size: 1
    - container_id: 1
      host_id: 100000
      size: 65536
  kernel: 6.12.24
  linkmode: dynamic
  logDriver: journald
  memFree: 1711906816
  memTotal: 15490879488
  networkBackend: netavark
  networkBackendInfo:
    backend: netavark
    dns:
      package: Unknown
      path: /nix/store/70fmmfn4vr4zlxmsmqlmr8h0qgvw3mvj-podman-5.4.1/libexec/podman/aardvark-dns
      version: aardvark-dns 1.14.0
    package: Unknown
    path: /nix/store/70fmmfn4vr4zlxmsmqlmr8h0qgvw3mvj-podman-5.4.1/libexec/podman/netavark
    version: netavark 1.14.1
  ociRuntime:
    name: crun
    package: Unknown
    path: /nix/store/cxp3gdx9kqksqsrvdxga6k0q2jyhw9x9-podman-helper-binary-wrapper/bin/crun
    version: |-
      crun version 1.21
      commit: 1.21
      rundir: /run/user/1000/crun
      spec: 1.0.0
      +SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +CRIU +YAJL
  os: linux
  pasta:
    executable: /nix/store/70fmmfn4vr4zlxmsmqlmr8h0qgvw3mvj-podman-5.4.1/libexec/podman/pasta
    package: Unknown
    version: ""
  remoteSocket:
    exists: true
    path: /run/user/1000/podman/podman.sock
  rootlessNetworkCmd: pasta
  security:
    apparmorEnabled: false
    capabilities: CAP_CHOWN,CAP_DAC_OVERRIDE,CAP_FOWNER,CAP_FSETID,CAP_KILL,CAP_NET_BIND_SERVICE,CAP_SETFCAP,CAP_SETGID,CAP_SETPCAP,CAP_SETUID,CAP_SYS_CHROOT
    rootless: true
    seccompEnabled: true
    seccompProfilePath: ""
    selinuxEnabled: false
  serviceIsRemote: false
  slirp4netns:
    executable: ""
    package: ""
    version: ""
  swapFree: 11822854144
  swapTotal: 17179865088
  uptime: 7h 1m 16.00s (Approximately 0.29 days)
  variant: ""
plugins:
  authorization: null
  log:
  - k8s-file
  - none
  - passthrough
  - journald
  network:
  - bridge
  - macvlan
  - ipvlan
  volume:
  - local
registries:
  search:
  - docker.io
  - quay.io
store:
  configFile: /home/h/.config/containers/storage.conf
  containerStore:
    number: 1
    paused: 0
    running: 1
    stopped: 0
  graphDriverName: overlay
  graphOptions: {}
  graphRoot: /home/h/.local/share/containers/storage
  graphRootAllocated: 449980137472
  graphRootUsed: 252282404864
  graphStatus:
    Backing Filesystem: zfs
    Native Overlay Diff: "true"
    Supports d_type: "true"
    Supports shifting: "false"
    Supports volatile: "true"
    Using metacopy: "false"
  imageCopyTmpDir: /var/tmp
  imageStore:
    number: 43
  runRoot: /run/user/1000/containers
  transientStore: false
  volumePath: /home/h/.local/share/containers/storage/volumes
version:
  APIVersion: 5.4.1
  Built: 315532800
  BuiltTime: Mon Dec 31 21:00:00 1979
  GitCommit: ""
  GoVersion: go1.24.2
  Os: linux
  OsArch: linux/amd64
  Version: 5.4.1

Podman in a container

No

Privileged Or Rootless

Rootless

Upstream Latest Release

No

Additional environment details

Linux NixOS unstable channel.

Additional information

No response

@heitorPB heitorPB added the kind/bug Categorizes issue or PR as related to a bug. label Apr 29, 2025
@ninja-quokka
Copy link
Collaborator

ninja-quokka commented Apr 30, 2025

Hi @heitorPB

If you are referring to image id 9a0ce6be5dd4 in your output, for an image to be considered "dangling" it needs to satisfy a few requirements, one of which is the name needs to be empty which is shown as <none>

9a0ce6be5dd4 has the name docker.io/library/postgres so it's not considered "dangling".

Some other checks are done on an image so even one with no name could still not be considered "dangling" if the image has children or is used in a manifest list.

For your reference below I have pasted the function we use to determine the "dangling" state.

Please let me know if this satisfies your bug report or if I have misunderstood your report.

// isDangling returns true if the image is dangling, that is an untagged image
// without children and not used in a manifest list.  If tree is nil, it will created for this invocation only.
func (i *Image) isDangling(ctx context.Context, tree *layerTree) (bool, error) {
   if len(i.Names()) > 0 {
   	return false, nil
   }
   children, err := i.getChildren(ctx, false, tree)
   if err != nil {
   	return false, err
   }
   _, usedInManfiestList := tree.manifestListDigests[i.Digest()]
   return (len(children) == 0 && !usedInManfiestList), nil
}

@ninja-quokka ninja-quokka added triaged Issue has been triaged needs-info Need info from reporter labels Apr 30, 2025
Copy link

A reviewer has determined we need more information to understand the reported issue. A comment on what is missing should be provided. Be certain you:

  • provide an exact reproducer where possible
  • verify you have provided all relevant information - minimum is podman info
  • answer any follow up questions

If no response to the needs-info is provided in 30 days, this issue may be closed by our stale bot.

For more information on reporting issues on this repository, consult our issue guide.

@heitorPB
Copy link
Author

Thanks for the quick reply @ninja-quokka!

My concept of dandling was not correct then. Any ideas how I could get an image without a tag?

@rhatdan
Copy link
Member

rhatdan commented Apr 30, 2025

Just build a new image with the same tag, then the original image with be untagged.
$ echo "from scratch" | podman build -t test -f -
STEP 1/1: FROM scratch
COMMIT test
--> 8aafbed4ce89
Successfully tagged localhost/test:latest

@ninja-quokka
Copy link
Collaborator

Thanks for the quick reply @ninja-quokka!

My concept of dandling was not correct then. Any ideas how I could get an image without a tag?

No worries mate,

Yeah it's a little complex. You can end up with images that have names and no tag when doing things like mulistage builds, it's not uncommon and if unused, can be cleaned up with a prune.

@Luap99
Copy link
Member

Luap99 commented May 2, 2025

My concept of dandling was not correct then. Any ideas how I could get an image without a tag?

podman untag is the simplest

@Luap99 Luap99 removed the needs-info Need info from reporter label May 2, 2025
@Luap99 Luap99 closed this as not planned Won't fix, can't repro, duplicate, stale May 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. triaged Issue has been triaged
Projects
None yet
Development

No branches or pull requests

4 participants