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

podman inspect network doesn't include running containers #14126

Closed
ChrisBr opened this issue May 5, 2022 · 19 comments · Fixed by #21860
Closed

podman inspect network doesn't include running containers #14126

ChrisBr opened this issue May 5, 2022 · 19 comments · Fixed by #21860
Assignees
Labels
5.0 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.

Comments

@ChrisBr
Copy link

ChrisBr commented May 5, 2022

/kind bug

Description

podman network inspect doesn't include containers using the network

Steps to reproduce the issue:

  1. Create network podman network create

  2. Start container podman run -it --network podman1 alpine

  3. Inspect network podman inspect podman1

Describe the results you received:

podman inspect podman1 does not contain a list of containers using the network.

Describe the results you expected:

Same command in docker contains a list of containers.

"Containers": {
  "bb522a1964c46b2970aa825cafce1bf2e971e195ad5b9784bb5bd13d53737e9d": {
      "Name": "elated_montalcini",
      "EndpointID": "08397fd8bb4e9c80a37b2bfb8f259c23181374dac2a0e1febcffcdc4d89bc32c",
      "MacAddress": "02:42:ac:1b:00:02",
      "IPv4Address": "172.27.0.2/16",
       "IPv6Address": ""
  }
}

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

Output of podman version:

Client:       Podman Engine
Version:      4.0.3
API Version:  4.0.3
Go Version:   go1.18
Built:        Fri Apr  1 16:28:59 2022
OS/Arch:      darwin/arm64

Server:       Podman Engine
Version:      4.0.3
API Version:  4.0.3
Go Version:   go1.18
Built:        Fri Apr  1 19:22:39 2022
OS/Arch:      linux/arm64

Output of podman info --debug:

host:
  arch: arm64
  buildahVersion: 1.24.3
  cgroupControllers:
  - cpuset
  - cpu
  - io
  - memory
  - pids
  - misc
  cgroupManager: systemd
  cgroupVersion: v2
  conmon:
    package: conmon-2.1.0-2.fc36.aarch64
    path: /usr/bin/conmon
    version: 'conmon version 2.1.0, commit: '
  cpus: 4
  distribution:
    distribution: fedora
    variant: coreos
    version: "36"
  eventLogger: journald
  hostname: localhost.localdomain
  idMappings:
    gidmap: null
    uidmap: null
  kernel: 5.17.3-300.fc36.aarch64
  linkmode: dynamic
  logDriver: journald
  memFree: 7293345792
  memTotal: 8304160768
  networkBackend: netavark
  ociRuntime:
    name: crun
    package: crun-1.4.4-1.fc36.aarch64
    path: /usr/bin/crun
    version: |-
      crun version 1.4.4
      commit: 6521fcc5806f20f6187eb933f9f45130c86da230
      spec: 1.0.0
      +SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +CRIU +YAJL
  os: linux
  remoteSocket:
    exists: true
    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
    seccompProfilePath: /usr/share/containers/seccomp.json
    selinuxEnabled: true
  serviceIsRemote: true
  slirp4netns:
    executable: /usr/bin/slirp4netns
    package: slirp4netns-1.2.0-0.2.beta.0.fc36.aarch64
    version: |-
      slirp4netns version 1.2.0-beta.0
      commit: 477db14a24ff1a3de3a705e51ca2c4c1fe3dda64
      libslirp: 4.6.1
      SLIRP_CONFIG_VERSION_MAX: 3
      libseccomp: 2.5.3
  swapFree: 0
  swapTotal: 0
  uptime: 3h 25m 5.43s (Approximately 0.12 days)
plugins:
  log:
  - k8s-file
  - none
  - passthrough
  - journald
  network:
  - bridge
  - macvlan
  volume:
  - local
registries:
  search:
  - docker.io
store:
  configFile: /usr/share/containers/storage.conf
  containerStore:
    number: 2
    paused: 0
    running: 0
    stopped: 2
  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"
  imageCopyTmpDir: /var/tmp
  imageStore:
    number: 9
  runRoot: /run/containers/storage
  volumePath: /var/lib/containers/storage/volumes
version:
  APIVersion: 4.0.3
  Built: 1648837359
  BuiltTime: Fri Apr  1 19:22:39 2022
  GitCommit: ""
  GoVersion: go1.18
  OsArch: linux/arm64
  Version: 4.0.3

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

brew info podman
podman: stable 4.0.3 (bottled), HEAD
Tool for managing OCI containers and pods
https://podman.io/
/opt/homebrew/Cellar/podman/4.0.3 (172 files, 46.2MB) *
  Poured from bottle on 2022-05-05 at 08:20:47
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/podman.rb
License: Apache-2.0
==> Dependencies
Build: go ✔, go-md2man ✘
Required: qemu ✔
==> Options
--HEAD
	Install HEAD version
==> Caveats
zsh completions have been installed to:
  /opt/homebrew/share/zsh/site-functions
==> Analytics
install: 17,297 (30 days), 48,514 (90 days), 131,788 (365 days)
install-on-request: 17,297 (30 days), 48,499 (90 days), 131,766 (365 days)
build-error: 1 (30 days)

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

Yes

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

Macbook M1 installed with homebrew

@openshift-ci openshift-ci bot added the kind/bug Categorizes issue or PR as related to a bug. label May 5, 2022
@github-actions github-actions bot added macos MacOS (OSX) related remote Problem is in podman-remote labels May 5, 2022
@Luap99
Copy link
Member

Luap99 commented May 5, 2022

@baude I think you looked at this before?

I am not the biggest fan of adding this to the network inspect output. The current network inspect output is not docker compatible at all, there are just a lot of different things in the podman/docker network stack.
Also your example output structure would not work because you can have more than ipv4 and ipv6 address per network. I also have no clue what the EndpointID is, is it the network ID?

You can get docker compatible output via the API. Although I am not sure if this is correctly implement there.

@rhatdan
Copy link
Member

rhatdan commented May 5, 2022

The question I have, Is it useful to a user to figure out which containers are using a particular network?

@Luap99
Copy link
Member

Luap99 commented May 5, 2022

The question I have, Is it useful to a user to figure out which containers are using a particular network?

You can get this with podman ps --filter network=name

@rhatdan
Copy link
Member

rhatdan commented May 5, 2022

Ok, as long as that is easy to retrieve, I don't see the compatibility as that big of an issue.

@baude
Copy link
Member

baude commented May 5, 2022

this is a duplicate of a jira card i was working on. the code is done but the problem is that would be a breaking change on output. we discussed podman 5, but i also would like to go back and look at things to see if i can weasel it in without breaking changes.

@ChrisBr
Copy link
Author

ChrisBr commented May 5, 2022

You can get this with podman ps --filter network=name

Our use case is that we have like 70-80 containers running and we need to find which ones are in the same network.

@ChrisBr
Copy link
Author

ChrisBr commented May 5, 2022

podman ps --filter network=name

This would work but would break compatibility with docker (which I understand is not a big concern for you).

@baude
Copy link
Member

baude commented May 5, 2022

we really do try on the compatibility stuff. in this case, the easy button just won't work ... but if you look at my update, i committed to trying it a different way. I have the code all written and it works, so not far away.

@github-actions
Copy link

github-actions bot commented Jun 5, 2022

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

@rhatdan
Copy link
Member

rhatdan commented Jun 6, 2022

@baude what is the state of this one now?

@baude
Copy link
Member

baude commented Jun 6, 2022

feel victim to other priorities. will try to pick back up soon,

@github-actions
Copy link

github-actions bot commented Jul 7, 2022

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

@rhatdan
Copy link
Member

rhatdan commented Jul 7, 2022

@Luap99 PTAL

@github-actions
Copy link

github-actions bot commented Aug 7, 2022

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

@rhatdan
Copy link
Member

rhatdan commented Aug 7, 2022

@baude @Luap99 @flouthoc PTAL

@github-actions
Copy link

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

@rhatdan
Copy link
Member

rhatdan commented Sep 12, 2022

@baude @Luap99 @flouthoc @mheon re-ping

@baude
Copy link
Member

baude commented Sep 12, 2022

cannot be done until podman 5

@baude baude added the 5.0 label Sep 12, 2022
@baude baude removed macos MacOS (OSX) related remote Problem is in podman-remote labels Sep 12, 2022
@rhatdan
Copy link
Member

rhatdan commented Sep 12, 2022

Sorry I missed that. Wish there was a way to stop the reminder on issues waiting for podman 5.

@Luap99 Luap99 self-assigned this Feb 28, 2024
Luap99 added a commit to Luap99/libpod that referenced this issue Feb 28, 2024
Like docker podman network inspect should output the information of
running container with their ip/mac address on this network.
However the output format is not docker compatible as this cannot
include all the info we have and the previous output was already not
compatible so this is not new.

New example output:
```
[
     {
          ...
          "containers": {
               "7c0d295779cee4a6db7adc07a99e635909413a390eeab9f951edbc4aac406bf1": {
                    "name": "c2",
                    "interfaces": {
                         "eth0": {
                              "subnets": [
                                   {
                                        "ipnet": "10.89.0.4/24",
                                        "gateway": "10.89.0.1"
                                   },
                                   {
                                        "ipnet": "fda3:b4da:da1e:7e9d::4/64",
                                        "gateway": "fda3:b4da:da1e:7e9d::1"
                                   }
                              ],
                              "mac_address": "1a:bd:ca:ea:4b:3a"
                         }
                    }
               },
               "b17c6651ae6d9cc7d5825968e01d6b1e67f44460bb0c140bcc32bd9d436ac11d": {
                    "name": "c1",
                    "interfaces": {
                         "eth0": {
                              "subnets": [
                                   {
                                        "ipnet": "10.89.0.3/24",
                                        "gateway": "10.89.0.1"
                                   },
                                   {
                                        "ipnet": "fda3:b4da:da1e:7e9d::3/64",
                                        "gateway": "fda3:b4da:da1e:7e9d::1"
                                   }
                              ],
                              "mac_address": "f6:50:e6:22:d9:55"
                         }
                    }
               }
          }
     }
]
```

Fixes containers#14126
Fixes https://issues.redhat.com/browse/RHEL-3153

Signed-off-by: Paul Holzinger <[email protected]>
@stale-locking-app stale-locking-app bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label May 29, 2024
@stale-locking-app stale-locking-app bot locked as resolved and limited conversation to collaborators May 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
5.0 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.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants