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

Container inspect endpoint is not Docker-API compatible #24910

Open
apollo13 opened this issue Dec 28, 2024 · 1 comment
Open

Container inspect endpoint is not Docker-API compatible #24910

apollo13 opened this issue Dec 28, 2024 · 1 comment
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@apollo13
Copy link

Issue Description

I am currently playing with podman compose utilizing the upstream docker-compose as backend. It always recreates the container because the network config is not as it should be. I added some debug prints to the docker-compose code and it cannot match the networks because the NetworkID returned by podman is wrong.

Running something along the lines of podman inspect 4cb3ce78cde3 --format="{{ json .NetworkSettings.Networks }}"|jq returns:

{
  "tmp_default": {
    "EndpointID": "",
    "Gateway": "10.89.0.1",
    "IPAddress": "10.89.0.3",
    "IPPrefixLen": 24,
    "IPv6Gateway": "",
    "GlobalIPv6Address": "",
    "GlobalIPv6PrefixLen": 0,
    "MacAddress": "c2:79:d5:75:e5:09",
    "NetworkID": "tmp_default",
    "DriverOpts": null,
    "IPAMConfig": null,
    "Links": null,
    "Aliases": [
      "tmp-traefik-1",
      "traefik",
      "4cb3ce78cde3"
    ]
  }
}

Here we can see that NetworkID is the network name and not the id of the network (podman network inspect tmp_default):

[
     {
          "name": "tmp_default",
          "id": "675bea81a6d49e9f1ae909c58a2269524a9a9c910f91bce12a85b05b882ab5cb",
          "driver": "bridge",
          "network_interface": "podman1",
          "created": "2024-12-28T20:54:28.320995381+01:00",
          "subnets": [
               {
                    "subnet": "10.89.0.0/24",
                    "gateway": "10.89.0.1"
               }
          ],
          "ipv6_enabled": false,
          "internal": false,
          "dns_enabled": true,
          "labels": {
               "com.docker.compose.config-hash": "4bd7e5f2ecc11ab238c4eb5931f77d1e2196619bcc8daeeb80428562a7210c37",
               "com.docker.compose.network": "default",
               "com.docker.compose.project": "tmp",
               "com.docker.compose.version": "2.32.1"
          },
          "options": {
               "isolate": "true"
          },
          "ipam_options": {
               "driver": "host-local"
          },
          "containers": {
               "4cb3ce78cde33f763bdd6abe5b19a5d93f5bb30043c94fa489114a48da5d4290": {
                    "name": "tmp-traefik-1",
                    "interfaces": {
                         "eth0": {
                              "subnets": [
                                   {
                                        "ipnet": "10.89.0.3/24",
                                        "gateway": "10.89.0.1"
                                   }
                              ],
                              "mac_address": "c2:79:d5:75:e5:09"
                         }
                    }
               }
          }
     }
]

Steps to reproduce the issue

Steps to reproduce the issue

  1. podman run --rm -it --name testing ubuntu:latest sleep infinity
  2. podman inspect testing --format="{{ json .NetworkSettings.Networks.podman }}"|jq
  3. Observe that the NetworkID is the network name

Describe the results you received

I would have expected the actual NetworkID to be shown

Describe the results you expected

The network name is shown as ID

podman info output

host:
  arch: amd64
  buildahVersion: 1.38.0
  cgroupControllers:
  - cpuset
  - cpu
  - io
  - memory
  - hugetlb
  - pids
  - rdma
  - misc
  cgroupManager: systemd
  cgroupVersion: v2
  conmon:
    package: conmon-2.1.12-3.fc41.x86_64
    path: /usr/bin/conmon
    version: 'conmon version 2.1.12, commit: '
  cpuUtilization:
    idlePercent: 97.27
    systemPercent: 0.8
    userPercent: 1.93
  cpus: 16
  databaseBackend: sqlite
  distribution:
    distribution: fedora
    variant: workstation
    version: "41"
  eventLogger: journald
  freeLocks: 2046
  hostname: apollo13
  idMappings:
    gidmap: null
    uidmap: null
  kernel: 6.12.4-200.fc41.x86_64
  linkmode: dynamic
  logDriver: journald
  memFree: 6023499776
  memTotal: 32395685888
  networkBackend: netavark
  networkBackendInfo:
    backend: netavark
    dns:
      package: aardvark-dns-1.13.1-1.fc41.x86_64
      path: /usr/libexec/podman/aardvark-dns
      version: aardvark-dns 1.13.1
    package: netavark-1.13.1-1.fc41.x86_64
    path: /usr/libexec/podman/netavark
    version: netavark 1.13.1
  ociRuntime:
    name: crun
    package: crun-1.19.1-1.fc41.x86_64
    path: /usr/bin/crun
    version: |-
      crun version 1.19.1
      commit: 3e32a70c93f5aa5fea69b50256cca7fd4aa23c80
      rundir: /run/crun
      spec: 1.0.0
      +SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +CRIU +LIBKRUN +WASM:wasmedge +YAJL
  os: linux
  pasta:
    executable: /usr/bin/pasta
    package: passt-0^20241211.g09478d5-1.fc41.x86_64
    version: |
      pasta 0^20241211.g09478d5-1.fc41.x86_64
      Copyright Red Hat
      GNU General Public License, version 2 or later
        <https://www.gnu.org/licenses/old-licenses/gpl-2.0.html>
      This is free software: you are free to change and redistribute it.
      There is NO WARRANTY, to the extent permitted by law.
  remoteSocket:
    exists: true
    path: /run/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: false
    seccompEnabled: true
    seccompProfilePath: /usr/share/containers/seccomp.json
    selinuxEnabled: true
  serviceIsRemote: false
  slirp4netns:
    executable: /usr/bin/slirp4netns
    package: slirp4netns-1.3.1-1.fc41.x86_64
    version: |-
      slirp4netns version 1.3.1
      commit: e5e368c4f5db6ae75c2fce786e31eef9da6bf236
      libslirp: 4.8.0
      SLIRP_CONFIG_VERSION_MAX: 5
      libseccomp: 2.5.5
  swapFree: 8589930496
  swapTotal: 8589930496
  uptime: 11h 16m 31.00s (Approximately 0.46 days)
  variant: ""
plugins:
  authorization: null
  log:
  - k8s-file
  - none
  - passthrough
  - journald
  network:
  - bridge
  - macvlan
  - ipvlan
  volume:
  - local
registries:
  search:
  - registry.fedoraproject.org
  - registry.access.redhat.com
  - docker.io
store:
  configFile: /usr/share/containers/storage.conf
  containerStore:
    number: 2
    paused: 0
    running: 2
    stopped: 0
  graphDriverName: overlay
  graphOptions:
    overlay.imagestore: /usr/lib/containers/storage
    overlay.mountopt: nodev,metacopy=on
  graphRoot: /var/lib/containers/storage
  graphRootAllocated: 536854134784
  graphRootUsed: 403665657856
  graphStatus:
    Backing Filesystem: btrfs
    Native Overlay Diff: "false"
    Supports d_type: "true"
    Supports shifting: "true"
    Supports volatile: "true"
    Using metacopy: "true"
  imageCopyTmpDir: /var/tmp
  imageStore:
    number: 5
  runRoot: /run/containers/storage
  transientStore: false
  volumePath: /var/lib/containers/storage/volumes
version:
  APIVersion: 5.3.1
  Built: 1732147200
  BuiltTime: Thu Nov 21 01:00:00 2024
  GitCommit: ""
  GoVersion: go1.23.3
  Os: linux
  OsArch: linux/amd64
  Version: 5.3.1

Podman in a container

No

Privileged Or Rootless

Privileged

Upstream Latest Release

No

Additional environment details

No response

Additional information

No response

@apollo13 apollo13 added the kind/bug Categorizes issue or PR as related to a bug. label Dec 28, 2024
@apollo13
Copy link
Author

Note that this only breaks docker-compose since commit docker/compose@c21d4cf which is in v2.31.0, docker-compose 2.30.3 is fine.

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.
Projects
None yet
Development

No branches or pull requests

1 participant