podman icon indicating copy to clipboard operation
podman copied to clipboard

Podman compatibility API network error

Open alekssd opened this issue 5 years ago • 2 comments

/kind bug

Description

Error 500 when trying to create a container with pre-created network with the docker compatible API We try to make testContainers framework works with podman, but can't get a container running with a network. Without a network, it is working fine.

Here is how to reproduce with curl

Steps to reproduce the issue:

  1. Start podman api : podman system service --time=0 tcp:0.0.0.0:56000 --log-level debug

  2. Create a network curl -X POST -H "Content-Type: application/json" -d @net.json http://localhost:56000/networks/create With payload : {"enableIPv6":null,"Name":"test-net","Driver":null,"IPAM":null,"Options":{},"CheckDuplicate":true,"Internal":null,"EnableIPv6":null,"Attachable":null,"Labels":{"org.testcontainers":"true","org.testcontainers.sessionId":"b073e659-2a7d-48ac-9430-26e043fb4641"}}

Response : {"Id":"254ddbe0ec1e5f3ed4b492876e2b6b9a051436b44c40d00ebd5e72bf7aa88435","Warning":null}

  1. get image :

curl -X POST http://localhost:56000/images/create?fromImage=registry.hub.docker.com/library/busybox

  1. Create a container curl -X POST -H "Content-Type: application/json" -d @cont.json http://localhost:56000/containers/create Payload : {"name":null,"authConfig":null,"platform":null,"Hostname":null,"Domainname":null,"User":null,"AttachStdin":null,"AttachStdout":null,"AttachStderr":null,"PortSpecs":null,"Tty":null,"OpenStdin":null,"StdinOnce":null,"Env":[],"Cmd":[],"Healthcheck":null,"ArgsEscaped":null,"Entrypoint":null,"Image":"registry.hub.docker.com/library/busybox","Volumes":{},"WorkingDir":null,"MacAddress":null,"OnBuild":null,"NetworkDisabled":null,"ExposedPorts":{"61616/tcp":{}},"StopSignal":null,"StopTimeout":null,"HostConfig":{"Binds":[],"BlkioWeight":null,"BlkioWeightDevice":null,"BlkioDeviceReadBps":null,"BlkioDeviceWriteBps":null,"BlkioDeviceReadIOps":null,"BlkioDeviceWriteIOps":null,"MemorySwappiness":null,"NanoCpus":null,"CapAdd":null,"CapDrop":null,"ContainerIDFile":null,"CpuPeriod":null,"CpuRealtimePeriod":null,"CpuRealtimeRuntime":null,"CpuShares":null,"CpuQuota":null,"CpusetCpus":null,"CpusetMems":null,"Devices":null,"DeviceCgroupRules":null,"DeviceRequests":null,"DiskQuota":null,"Dns":null,"DnsOptions":null,"DnsSearch":null,"ExtraHosts":[],"GroupAdd":null,"IpcMode":null,"Cgroup":null,"Links":[],"LogConfig":null,"LxcConf":null,"Memory":null,"MemorySwap":null,"MemoryReservation":null,"KernelMemory":null,"NetworkMode":"254ddbe0ec1e5f3ed4b492876e2b6b9a051436b44c40d00ebd5e72bf7aa88435","OomKillDisable":null,"Init":null,"AutoRemove":null,"OomScoreAdj":null,"PortBindings":{"61616/tcp":[{"HostIp":"","HostPort":""}]},"Privileged":null,"PublishAllPorts":null,"ReadonlyRootfs":null,"RestartPolicy":null,"Ulimits":null,"CpuCount":null,"CpuPercent":null,"IOMaximumIOps":null,"IOMaximumBandwidth":null,"VolumesFrom":[],"Mounts":null,"PidMode":null,"Isolation":null,"SecurityOpt":null,"StorageOpt":null,"CgroupParent":null,"VolumeDriver":null,"ShmSize":null,"PidsLimit":null,"Runtime":null,"Tmpfs":null,"UTSMode":null,"UsernsMode":null,"Sysctls":null,"ConsoleSize":null},"Labels":{"org.testcontainers":"true","org.testcontainers.sessionId":"b071e659-2a7d-48ac-9430-26e043fb4641"},"Shell":null,"NetworkingConfig":{"EndpointsConfig":{"254ddbe0ec1e5f3ed4b492876e2b6b9a051436b44c40d00ebd5e72bf7aa88435":{"IPAMConfig":null,"Links":null,"Aliases":["tc-bpZ991mD","busybox.local"],"NetworkID":null,"EndpointID":null,"Gateway":null,"IPAddress":null,"IPPrefixLen":null,"IPv6Gateway":null,"GlobalIPv6Address":null,"GlobalIPv6PrefixLen":null,"MacAddress":null}}}}

Response : {"cause":"network not found","message":"container create: container d94b1f92a8f34cec66eb6a8db60d2a1912e50e533401fe384ee3f7b27993d5b6 has network aliases for network \"254ddbe0ec1e5f3ed4b492876e2b6b9a051436b44c40d00ebd5e72bf7aa88435\" but is not part of that network: network not found","response":500}

  1. Search for network : curl http://localhost:56000/networks/254ddbe0ec1e5f3ed4b492876e2b6b9a051436b44c40d00ebd5e72bf7aa88435

response : {"Name":"test-net","Id":"254ddbe0ec1e5f3ed4b492876e2b6b9a051436b44c40d00ebd5e72bf7aa88435","Created":"2021-08-19T13:33:39.41-04:00","Scope":"local","Driver":"bridge","EnableIPv6":false,"IPAM":{"Driver":"default","Options":{},"Config":[{"Subnet":"10.88.2.0/24","Gateway":"10.88.2.1"}]},"Internal":false,"Attachable":false,"Ingress":false,"ConfigFrom":{"Network":""},"ConfigOnly":false,"Containers":{},"Options":{},"Labels":{"org.testcontainers":"true","org.testcontainers.sessionId":"b073e659-2a7d-48ac-9430-26e043fb4641"}}

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

Output of podman version:

Version:      3.2.2
API Version:  3.2.2
Go Version:   go1.15.2
Built:        Wed Dec 31 19:00:00 1969
OS/Arch:      linux/amd64

Output of podman info --debug:

host:
  arch: amd64
  buildahVersion: 1.21.0
  cgroupControllers: []
  cgroupManager: cgroupfs
  cgroupVersion: v1
  conmon:
    package: 'conmon: /usr/libexec/podman/conmon'
    path: /usr/libexec/podman/conmon
    version: 'conmon version 2.0.27, commit: '
  cpus: 8
  distribution:
    distribution: ubuntu
    version: "20.04"
  eventLogger: journald
  hostname: PPF0988
  idMappings:
    gidmap:
    - container_id: 0
      host_id: 1000
      size: 1
    - container_id: 1
      host_id: 100000
      size: 65536
    uidmap:
    - container_id: 0
      host_id: 1000
      size: 1
    - container_id: 1
      host_id: 100000
      size: 65536
  kernel: 5.4.72-microsoft-standard-WSL2
  linkmode: dynamic
  memFree: 1123717120
  memTotal: 13250801664
  ociRuntime:
    name: crun
    package: 'crun: /usr/bin/crun'
    path: /usr/bin/crun
    version: |-
      crun version 0.20.1.5-925d-dirty
      commit: 0d42f1109fd73548f44b01b3e84d04a279e99d2e
      spec: 1.0.0
      +SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +CRIU +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
    seccompProfilePath: /usr/share/containers/seccomp.json
    selinuxEnabled: false
  serviceIsRemote: false
  slirp4netns:
    executable: /usr/bin/slirp4netns
    package: 'slirp4netns: /usr/bin/slirp4netns'
    version: |-
      slirp4netns version 1.1.8
      commit: unknown
      libslirp: 4.3.1-git
      SLIRP_CONFIG_VERSION_MAX: 3
      libseccomp: 2.4.3
  swapFree: 4283944960
  swapTotal: 4294967296
  uptime: 25h 14m 6.62s (Approximately 1.04 days)
registries:
  search:
  - docker.io
  - quay.io
store:
  configFile: /home/XXXXX/.config/containers/storage.conf
  containerStore:
    number: 49
    paused: 0
    running: 0
    stopped: 49
  graphDriverName: overlay
  graphOptions:
    overlay.mount_program:
      Executable: /usr/bin/fuse-overlayfs
      Package: 'fuse-overlayfs: /usr/bin/fuse-overlayfs'
      Version: |-
        fusermount3 version: 3.9.0
        fuse-overlayfs: version 1.5
        FUSE library version 3.9.0
        using FUSE kernel interface version 7.31
  graphRoot: /home/XXXXX/.local/share/containers/storage
  graphStatus:
    Backing Filesystem: extfs
    Native Overlay Diff: "false"
    Supports d_type: "true"
    Using metacopy: "false"
  imageStore:
    number: 44
  runRoot: /run/user/1000/containers
  volumePath: /home/XXXXX/.local/share/containers/storage/volumes
version:
  APIVersion: 3.2.2
  Built: 0
  BuiltTime: Wed Dec 31 19:00:00 1969
  GitCommit: ""
  GoVersion: go1.15.2
  OsArch: linux/amd64
  Version: 3.2.2

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

Listing... Done
podman/unknown 100:3.2.3-1 amd64 [upgradable from: 100:3.2.2-1]
podman/unknown 100:3.2.3-1 arm64
podman/unknown 100:3.2.3-1 armhf
podman/unknown 100:3.2.3-1 s390x

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)

No, just with 3.2.2, yes I checked troubleshooting

Additional environment details (AWS, VirtualBox, physical, etc.): Running on WSL2 Ubuntu 20.04

alekssd avatar Aug 19 '21 18:08 alekssd

is this due to using the ID instead of the name?

baude avatar Aug 19 '21 18:08 baude

@baude Yep, I'd assume it's a bug - we're translating the ID to a network name in one plane (the networks list) but not another (the aliases)

mheon avatar Aug 19 '21 18:08 mheon