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.sock network mode compatibility when creating container #23453

Open
panda2134 opened this issue Jul 31, 2024 · 3 comments
Open

podman.sock network mode compatibility when creating container #23453

panda2134 opened this issue Jul 31, 2024 · 3 comments
Labels
kind/bug Categorizes issue or PR as related to a bug. network Networking related issue or feature

Comments

@panda2134
Copy link

panda2134 commented Jul 31, 2024

Issue Description

podman.sock seems to be converting default network names to bridge to mimic docker behavior. Even when podman network ls shows the default network name as podman, a RESTful API request to /networks/ still returns the network name as bridge.

This behavior is not consistent with /containers/create. When the network name "bridge" is used in "NetworkingConfig.EndpointsConfig", podman returns 500 saying that "container create: unable to find network with name or ID bridge: network not found"

Steps to reproduce the issue

Steps to reproduce the issue

Run the following script after enabling podman.sock:

podman pull alpine
cat >/tmp/1.json <<EOF
{
    "Image": "alpine",
    "HostConfig": {
        "NetworkMode": "bridge"
    },
    "NetworkingConfig": {
        "EndpointsConfig": {
            "bridge": {
                "Aliases": []
            }
        }
    }
}
EOF
curl --unix-socket $XDG_RUNTIME_DIR/podman/podman.sock -H 'content-type: application/json' -d @/tmp/1.json http://localhost/containers/create

Describe the results you received

Error: {"cause":"network not found","message":"container create: unable to find network with name or ID bridge: network not found","response":500}

Describe the results you expected

No errors.

podman info output

host:
  arch: arm64
  buildahVersion: 1.36.0
  cgroupControllers:
  - cpuset
  - cpu
  - io
  - memory
  - pids
  cgroupManager: systemd
  cgroupVersion: v2
  conmon:
    package: conmon-2.1.10-1.fc40.aarch64
    path: /usr/bin/conmon
    version: 'conmon version 2.1.10, commit: '
  cpuUtilization:
    idlePercent: 99.07
    systemPercent: 0.35
    userPercent: 0.58
  cpus: 4
  databaseBackend: sqlite
  distribution:
    distribution: fedora
    variant: cloud
    version: "40"
  eventLogger: journald
  freeLocks: 2048
  hostname: lima-fedora
  idMappings:
    gidmap:
    - container_id: 0
      host_id: 1000
      size: 1
    - container_id: 1
      host_id: 100000
      size: 65536
    uidmap:
    - container_id: 0
      host_id: 501
      size: 1
    - container_id: 1
      host_id: 100000
      size: 65536
  kernel: 6.8.5-301.fc40.aarch64
  linkmode: dynamic
  logDriver: journald
  memFree: 1994862592
  memTotal: 4084531200
  networkBackend: netavark
  networkBackendInfo:
    backend: netavark
    dns:
      package: aardvark-dns-1.11.0-1.fc40.aarch64
      path: /usr/libexec/podman/aardvark-dns
      version: aardvark-dns 1.11.0
    package: netavark-1.11.0-1.fc40.aarch64
    path: /usr/libexec/podman/netavark
    version: netavark 1.11.0
  ociRuntime:
    name: crun
    package: crun-1.15-1.fc40.aarch64
    path: /usr/bin/crun
    version: |-
      crun version 1.15
      commit: e6eacaf4034e84185fd8780ac9262bbf57082278
      rundir: /run/user/501/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^20240624.g1ee2eca-1.fc40.aarch64
    version: |
      pasta 0^20240624.g1ee2eca-1.fc40.aarch64-pasta
      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/user/501/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: true
    seccompEnabled: true
    seccompProfilePath: /usr/share/containers/seccomp.json
    selinuxEnabled: true
  serviceIsRemote: false
  slirp4netns:
    executable: /usr/local/bin/slirp4netns
    package: Unknown
    version: |-
      slirp4netns version 1.2.3
      commit: c22fde291bb35b354e6ca44d13be181c76a0a432
      libslirp: 4.7.0
      SLIRP_CONFIG_VERSION_MAX: 4
      libseccomp: 2.5.3
  swapFree: 4084199424
  swapTotal: 4084199424
  uptime: 0h 32m 50.00s
  variant: v8
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: /home/panda2134.linux/.config/containers/storage.conf
  containerStore:
    number: 0
    paused: 0
    running: 0
    stopped: 0
  graphDriverName: overlay
  graphOptions: {}
  graphRoot: /home/panda2134.linux/.local/share/containers/storage
  graphRootAllocated: 106219679744
  graphRootUsed: 972353536
  graphStatus:
    Backing Filesystem: btrfs
    Native Overlay Diff: "true"
    Supports d_type: "true"
    Supports shifting: "false"
    Supports volatile: "true"
    Using metacopy: "false"
  imageCopyTmpDir: /var/tmp
  imageStore:
    number: 1
  runRoot: /run/user/501/containers
  transientStore: false
  volumePath: /home/panda2134.linux/.local/share/containers/storage/volumes
version:
  APIVersion: 5.1.2
  Built: 1720569600
  BuiltTime: Wed Jul 10 08:00:00 2024
  GitCommit: ""
  GoVersion: go1.22.5
  Os: linux
  OsArch: linux/arm64
  Version: 5.1.2

Podman in a container

No

Privileged Or Rootless

Rootless

Upstream Latest Release

Yes

Additional environment details

It would be better if there's a switch to turn off all these compat features in podman.sock like converting network names.

Additional information

Additional information like issue happens only occasionally or issue happens with a particular architecture or on a particular setting

@panda2134 panda2134 added the kind/bug Categorizes issue or PR as related to a bug. label Jul 31, 2024
@Luap99 Luap99 added the network Networking related issue or feature label Aug 5, 2024
Copy link

github-actions bot commented Sep 5, 2024

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

@rhatdan
Copy link
Member

rhatdan commented Sep 5, 2024

@Luap99 Any ideas on this one?

@Luap99
Copy link
Member

Luap99 commented Sep 5, 2024

Translate the name the same same way it done in the network endpoints

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. network Networking related issue or feature
Projects
None yet
Development

No branches or pull requests

3 participants