Skip to content
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

docker api: ContainerList does not seem to recognize filter arguments #9544

Closed
rmohr opened this issue Mar 1, 2021 · 6 comments
Closed

docker api: ContainerList does not seem to recognize filter arguments #9544

rmohr opened this issue Mar 1, 2021 · 6 comments
Labels
kind/bug Categorizes issue or PR as related to a bug. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. stale-issue

Comments

@rmohr
Copy link

rmohr commented Mar 1, 2021

Is this a BUG REPORT or FEATURE REQUEST? (leave only one on its own line)

/kind bug

Description

When applying a filter to ContainerList, I don't get the expected containers returned.

Steps to reproduce the issue:

Call podman with the docker sdk like this:

	args := filters.NewArgs(filters.KeyValuePair{
		Key:   "name",
		Value: prefix,
	})
	containers, err := cli.ContainerList(context.Background(), types.ContainerListOptions{
		Filters: args,
		All:     true,
	})
	return containers, err

Describe the results you received:

I get no containers with prefix prefix* back. The result is empty.

Describe the results you expected:

Against the docker daemon I get all containers starting with prefix returned.
For instance, if prefix has the value test, I would expect that I get containers like this back :test1, test-something.

Note that VolumeList it returns the expected results.

Additional information you deem important (e.g. issue happens only occasionally):

Output of podman version:

$ podman version
Version:      3.1.0-dev
API Version:  3.0.0
Go Version:   go1.14.6
Git Commit:   bde1d3f281b4d06b87320f3f001e67c79474a6a5
Built:        Fri Feb 26 10:38:59 2021
OS/Arch:      linux/amd64

Output of podman info --debug:

$ podman info --debug
host:
  arch: amd64
  buildahVersion: 1.19.6
  cgroupManager: cgroupfs
  cgroupVersion: v1
  conmon:
    package: conmon-2.0.19-1.fc32.x86_64
    path: /usr/bin/conmon
    version: 'conmon version 2.0.19, commit: 5dce9767526ed27f177a8fa3f281889ad509fea7'
  cpus: 8
  distribution:
    distribution: fedora
    version: "32"
  eventLogger: journald
  hostname: linux.fritz.box
  idMappings:
    gidmap:
    - container_id: 0
      host_id: 1000
      size: 1
    - container_id: 1
      host_id: 2000544
      size: 65536
    uidmap:
    - container_id: 0
      host_id: 1000
      size: 1
    - container_id: 1
      host_id: 2000544
      size: 65536
  kernel: 5.8.10-200.fc32.x86_64
  linkmode: dynamic
  memFree: 1730748416
  memTotal: 16647061504
  ociRuntime:
    name: crun
    package: crun-0.14.1-1.fc32.x86_64
    path: /usr/bin/crun
    version: |-
      crun version 0.14.1
      commit: 598ea5e192ca12d4f6378217d3ab1415efeddefa
      spec: 1.0.0
      +SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +YAJL
  os: linux
  remoteSocket:
    path: /run/user/1000/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
    selinuxEnabled: true
  slirp4netns:
    executable: /usr/bin/slirp4netns
    package: slirp4netns-1.1.4-1.fc32.x86_64
    version: |-
      slirp4netns version 1.1.4
      commit: b66ffa8e262507e37fca689822d23430f3357fe8
      libslirp: 4.3.1
      SLIRP_CONFIG_VERSION_MAX: 2
  swapFree: 21044404224
  swapTotal: 24008192000
  uptime: 193h 51m 37.55s (Approximately 8.04 days)
registries:
  search:
  - registry.fedoraproject.org
  - registry.access.redhat.com
  - registry.centos.org
  - docker.io
store:
  configFile: /home/rmohr/.config/containers/storage.conf
  containerStore:
    number: 0
    paused: 0
    running: 0
    stopped: 0
  graphDriverName: overlay
  graphOptions:
    overlay.mount_program:
      Executable: /usr/bin/fuse-overlayfs
      Package: fuse-overlayfs-1.1.2-1.fc32.x86_64
      Version: |-
        fusermount3 version: 3.9.1
        fuse-overlayfs: version 1.1.0
        FUSE library version 3.9.1
        using FUSE kernel interface version 7.31
  graphRoot: /home/rmohr/.local/share/containers/storage
  graphStatus:
    Backing Filesystem: extfs
    Native Overlay Diff: "false"
    Supports d_type: "true"
    Using metacopy: "false"
  imageStore:
    number: 1
  runRoot: /run/user/1000/containers
  volumePath: /home/rmohr/.local/share/containers/storage/volumes
version:
  APIVersion: 3.0.0
  Built: 1614332339
  BuiltTime: Fri Feb 26 10:38:59 2021
  GitCommit: bde1d3f281b4d06b87320f3f001e67c79474a6a5
  GoVersion: go1.14.6
  OsArch: linux/amd64
  Version: 3.1.0-dev

Package info (e.g. output of rpm -q podman or apt list podman):

developer version

Have you tested with the latest version of Podman and have you checked the Podman Troubleshooting Guide?

Yes

Additional environment details (AWS, VirtualBox, physical, etc.):

@openshift-ci-robot openshift-ci-robot added the kind/bug Categorizes issue or PR as related to a bug. label Mar 1, 2021
@rmohr rmohr changed the title docker api: ContainerList does not seem to recognize filter arguments docker api: ContainerList does not seem to recognize filter arguments Mar 1, 2021
@mheon
Copy link
Member

mheon commented Mar 1, 2021

@baude PTAL

@baude
Copy link
Member

baude commented Mar 2, 2021

Seems to work for me with upstream main.

$ sudo curl -X GET --unix-socket /var/run/docker.sock 'http://localhost/containers/json?all=true&external=false&filters=%7B%22name%22%3A%5B%22test%22%5D%7D&last=-1&namespace=false&size=false&sync=false' | jq '.[].Names[0]'
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  1310  100  1310    0     0  1279k      0 --:--:-- --:--:-- --:--:-- 1279k
"/testing"
"/test1"
"/test-1"

@rmohr
Copy link
Author

rmohr commented Mar 2, 2021

did you try it through the docker-sdk? I get empty results there. Btw, why is there a / in front of the names? Maybe that is also the case on docker and I just did not realize it?

@baude
Copy link
Member

baude commented Mar 2, 2021

@rmohr No I didnt try it through the docker sdk. I don't have time for that. The / is standard. One thing you can try ... try running podman --log-level=debug system service -t0 and look at the the debug info to see what the url is that is being sent. From that perhaps we can understand what's going on.

@github-actions
Copy link

github-actions bot commented Apr 2, 2021

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

@rhatdan
Copy link
Member

rhatdan commented Apr 5, 2021

Since we got no more feedback, I will assume this is fixed in the main branch.

@rhatdan rhatdan closed this as completed Apr 5, 2021
@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 22, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Categorizes issue or PR as related to a bug. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. stale-issue
Projects
None yet
Development

No branches or pull requests

5 participants