containers / podman

Podman: A tool for managing OCI containers and pods.
https://podman.io
Apache License 2.0
23.27k stars 2.37k forks source link

Multiple filter options do not act as logical AND for podman images #21803

Closed ankurmalhotra07 closed 5 months ago

ankurmalhotra07 commented 7 months ago

Issue Description

Similar issue as was described for volume in #19219

Using multiple --filter option on images is an OR but should be AND.

Steps to reproduce the issue

Steps to reproduce the issue

  1. podman build .
  2. podman images -q -f label=build=build -f label=stage=A

Dockerfile:

# syntax=docker/dockerfile:1
FROM golang:1.21
WORKDIR /src
LABEL stage=A
LABEL build=build
COPY <<EOF ./main.go
package main

import "fmt"

func main() {
  fmt.Println("hello, world")
}
EOF
RUN go build -o /bin/hello ./main.go

FROM scratch
LABEL stage=A
COPY --from=0 /bin/hello /bin/hello
CMD ["/bin/hello"]

Describe the results you received

podman images -q -f label=build=build  -f label=stage=A
0da55797b275
9042bf9d7696
5185d084c4ba

Describe the results you expected

Describe the results you expectedpodman images -q -f label=build=build  -f label=stage=A
5185d084c4ba

podman info output

host:
  arch: arm64
  buildahVersion: 1.33.3
  cgroupControllers:
  - cpu
  - io
  - memory
  - pids
  cgroupManager: systemd
  cgroupVersion: v2
  conmon:
    package: conmon-2.1.8-2.fc39.aarch64
    path: /usr/bin/conmon
    version: 'conmon version 2.1.8, commit: '
  cpuUtilization:
    idlePercent: 82.96
    systemPercent: 0.94
    userPercent: 16.1
  cpus: 6
  databaseBackend: sqlite
  distribution:
    distribution: fedora
    variant: coreos
    version: "39"
  eventLogger: journald
  hostname: localhost.localdomain
  idMappings:
    gidmap:
    - container_id: 0
      host_id: 1000
      size: 1
    - container_id: 1
      host_id: 100000
      size: 1000000
    uidmap:
    - container_id: 0
      host_id: 503
      size: 1
    - container_id: 1
      host_id: 100000
      size: 1000000
  kernel: 6.7.4-200.fc39.aarch64
  linkmode: dynamic
  logDriver: journald
  memFree: 317169664
  memTotal: 3093733376
  networkBackend: netavark
  ociRuntime:
    name: crun
    package: crun-1.14-1.fc39.aarch64
    path: /usr/bin/crun
    version: |-
      crun version 1.14
      commit: 667e6ebd4e2442d39512e63215e79d693d0780aa
      rundir: /run/user/503/crun
      spec: 1.0.0
      +SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +CRIU +LIBKRUN +WASM:wasmedge +YAJL
  os: linux
  remoteSocket:
    exists: true
    path: /run/user/503/podman/podman.sock
  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: /usr/share/containers/seccomp.json
    selinuxEnabled: true
  serviceIsRemote: true
  slirp4netns:
    executable: /usr/bin/slirp4netns
    package: slirp4netns-1.2.2-1.fc39.aarch64
    version: |-
      slirp4netns version 1.2.2
      commit: 0ee2d87523e906518d34a6b423271e4826f71faf
      libslirp: 4.7.0
      SLIRP_CONFIG_VERSION_MAX: 4
      libseccomp: 2.5.3
  swapFree: 0
  swapTotal: 0
  uptime: 37h 55m 45.00s (Approximately 1.54 days)
plugins:
  authorization: null
  log:
  - k8s-file
  - none
  - passthrough
  - journald
  network:
  - bridge
  - macvlan
  - ipvlan
  volume:
  - local
registries:
  search:
  - docker.io
store:
  configFile: /var/home/core/.config/containers/storage.conf
  containerStore:
    number: 0
    paused: 0
    running: 0
    stopped: 0
  graphDriverName: overlay
  graphOptions: {}
  graphRoot: /var/home/core/.local/share/containers/storage
  graphRootAllocated: 106769133568
  graphRootUsed: 7399866368
  graphStatus:
    Backing Filesystem: xfs
    Native Overlay Diff: "true"
    Supports d_type: "true"
    Supports shifting: "false"
    Supports volatile: "true"
    Using metacopy: "false"
  imageCopyTmpDir: /var/tmp
  imageStore:
    number: 38
  runRoot: /run/user/503/containers
  transientStore: false
  volumePath: /var/home/core/.local/share/containers/storage/volumes
version:
  APIVersion: 4.9.0
  Built: 1706090829
  BuiltTime: Wed Jan 24 05:07:09 2024
  GitCommit: ""
  GoVersion: go1.21.6
  Os: linux
  OsArch: linux/arm64
  Version: 4.9.0

Podman in a container

No

Privileged Or Rootless

None

Upstream Latest Release

Yes

Additional environment details

Additional environment details

Additional information

 podman images --format "table {{.ID}} {{.Repository}} {{.Tag}} {{.Labels}}" 
IMAGE ID      REPOSITORY                         TAG               LABELS
0da55797b275  <none>                             <none>            map[io.buildah.version:1.33.3 stage:A]
9042bf9d7696  <none>                             <none>            map[io.buildah.version:1.33.3 stage:A]
5185d084c4ba  <none>                             <none>            map[build:build io.buildah.version:1.33.3 stage:A]
bc759931695c  <none>                             <none>            map[build: image:build io.buildah.version:1.33.3]
github-actions[bot] commented 6 months ago

A friendly reminder that this issue had no activity for 30 days.

Luap99 commented 5 months ago

I think this was fixed in https://github.com/containers/podman/pull/21260 please test with 5.0 again