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

support the container:... notation for ps --filter network=... #10361

Closed
dsedivec opened this issue May 17, 2021 · 5 comments · Fixed by #11075
Closed

support the container:... notation for ps --filter network=... #10361

dsedivec opened this issue May 17, 2021 · 5 comments · Fixed by #11075
Labels
Good First Issue This issue would be a good issue for a first time contributor to undertake. kind/feature Categorizes issue or PR as related to a new feature. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.

Comments

@dsedivec
Copy link

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

/kind bug

Description

I can't find any reasonable way to ask for all containers that are using another container's network.

Steps to reproduce the issue:

  1. podman run --name=alpha --net=testnet -d docker.io/alpine sleep 1h

  2. podman run --name=bravo --net=container:alpha -d docker.io/alpine sleep 1h

  3. podman container ps --filter network=container:alpha

Describe the results you received:

No containers listed

Describe the results you expected:

Container bravo listed (and maybe alpha too, I'm not that picky)

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

podman container ps --filter network=testnet only lists alpha, not bravo. podman container ps --filter network=container:$(podman inspect --format {{.ID}} alpha) doesn't list anything.

podman container ps --format '{{.Names}} {{.Networks}}' tells me that it thinks bravo is in the podman network, which seems wrong.

Output of podman version:

podman version
Version:      3.1.2
API Version:  3.1.2
Go Version:   go1.16
Built:        Thu Apr 22 06:11:28 2021
OS/Arch:      linux/amd64

Output of podman info --debug:

host:
  arch: amd64
  buildahVersion: 1.20.1
  cgroupManager: systemd
  cgroupVersion: v2
  conmon:
    package: conmon-2.0.27-2.fc34.x86_64
    path: /usr/bin/conmon
    version: 'conmon version 2.0.27, commit: '
  cpus: 8
  distribution:
    distribution: fedora
    version: "34"
  eventLogger: journald
  hostname: mmhmm
  idMappings:
    gidmap: null
    uidmap: null
  kernel: 5.11.13-300.fc34.x86_64
  linkmode: dynamic
  memFree: 782872576
  memTotal: 16676921344
  ociRuntime:
    name: runc
    package: runc-1.0.0-377.rc93.fc34.x86_64
    path: /usr/bin/runc
    version: |-
      runc version 1.0.0-rc93
      commit: 48389904331fdebba5e2db73147c067560a51d80
      spec: 1.0.2-dev
      go: go1.16
      libseccomp: 2.5.0
  os: linux
  remoteSocket:
    path: /run/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: false
    seccompEnabled: true
    selinuxEnabled: true
  slirp4netns:
    executable: ""
    package: ""
    version: ""
  swapFree: 16981417984
  swapTotal: 17179860992
  uptime: 357h 25m 26.72s (Approximately 14.88 days)
registries:
  search:
  - registry.fedoraproject.org
  - registry.access.redhat.com
  - docker.io
  - quay.io
store:
  configFile: /etc/containers/storage.conf
  containerStore:
    number: 5
    paused: 0
    running: 1
    stopped: 4
  graphDriverName: overlay
  graphOptions:
    overlay.mountopt: nodev,metacopy=on
  graphRoot: /var/lib/containers/storage
  graphStatus:
    Backing Filesystem: xfs
    Native Overlay Diff: "false"
    Supports d_type: "true"
    Using metacopy: "true"
  imageStore:
    number: 25
  runRoot: /run/containers/storage
  volumePath: /var/lib/containers/storage/volumes
version:
  APIVersion: 3.1.2
  Built: 1619097088
  BuiltTime: Thu Apr 22 06:11:28 2021
  GitCommit: ""
  GoVersion: go1.16
  OsArch: linux/amd64
  Version: 3.1.2

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

podman-3.1.2-1.fc34.x86_64

Have you tested with the latest version of Podman and have you checked the Podman Troubleshooting Guide? (https://github.com/containers/podman/blob/master/troubleshooting.md)

Yes

@openshift-ci openshift-ci bot added the kind/bug Categorizes issue or PR as related to a bug. label May 17, 2021
@rhatdan
Copy link
Member

rhatdan commented May 17, 2021

@mheon @vrothberg Thoughts? Should this be something in inspect? Or ps?

@mheon
Copy link
Member

mheon commented May 17, 2021

I dunno. Does Docker consider a container that joined another container's network namespace to be a member of the second container's CNI networks? Need to verify. If so, this will require fixes in the ps code.

@zhangguanzhang
Copy link
Collaborator

docker also
docker container ps --filter network=testnet only lists alpha

@vrothberg
Copy link
Member

ps --filter network=... expects the name or full ID of the network. The container:... notation is not supported (yet).

@vrothberg vrothberg added kind/feature Categorizes issue or PR as related to a new feature. and removed kind/bug Categorizes issue or PR as related to a bug. labels Jun 1, 2021
@vrothberg vrothberg changed the title Can't list containers using another container's network support the container:... notation for ps --filter network=... Jun 1, 2021
@github-actions
Copy link

github-actions bot commented Jul 2, 2021

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

@rhatdan rhatdan added Good First Issue This issue would be a good issue for a first time contributor to undertake. and removed stale-issue labels Jul 2, 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 21, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Good First Issue This issue would be a good issue for a first time contributor to undertake. kind/feature Categorizes issue or PR as related to a new feature. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants