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

Docker compatibility: Container inspect endpoint returns null for NetworkSettings/Ports #6803

Closed
skorhone opened this issue Jun 27, 2020 · 4 comments
Assignees
Labels
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

@skorhone
Copy link

skorhone commented Jun 27, 2020

/kind bug

Description

Steps to reproduce the issue:

  1. Create a container with published ports

  2. Call docker compatible container inspect api endpoint

Describe the results you received:
Ports is returned as null. There is no code for mapping NetworkSettings

Describe the results you expected:
NetworkSettings is returned with published Ports. If random host port was requested (port was undefined), then ranomized port should be returned as HostPort

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

Output of podman version:

Version:      2.0.0
API Version:  1
Go Version:   go1.13.8
Built:        Thu Jan  1 02:00:00 1970
OS/Arch:      linux/amd64
@openshift-ci-robot openshift-ci-robot added the kind/bug Categorizes issue or PR as related to a bug. label Jun 27, 2020
@skorhone
Copy link
Author

skorhone commented Jun 27, 2020

And here's an example json that exposes port 6379/tcp and sets PublishAllPorts to true:

{
   "name":null,
   "authConfig":null,
   "Hostname":null,
   "Domainname":null,
   "User":null,
   "AttachStdin":null,
   "AttachStdout":null,
   "AttachStderr":null,
   "PortSpecs":null,
   "Tty":null,
   "OpenStdin":null,
   "StdinOnce":null,
   "Env":[

   ],
   "Cmd":[
      "docker-entrypoint.sh",
      "redis-server"
   ],
   "Healthcheck":null,
   "ArgsEscaped":null,
   "Entrypoint":null,
   "Image":"redis:5.0.3-alpine",
   "Volumes":{

   },
   "WorkingDir":null,
   "MacAddress":null,
   "OnBuild":null,
   "NetworkDisabled":null,
   "ExposedPorts":{
      "6379/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":null,
      "OomKillDisable":null,
      "Init":null,
      "AutoRemove":null,
      "OomScoreAdj":null,
      "PortBindings":{

      },
      "Privileged":null,
      "PublishAllPorts":true,
      "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":"a3abb681-b4c5-41ae-88ff-dd53c9567565"
   },
   "Shell":null,
   "NetworkingConfig":null
}

@skorhone
Copy link
Author

skorhone commented Jul 1, 2020

I'll see, if I can setup a dev environment to create patch for this tomorrow. Not sure, if I'll find time to map all variables from NetworkSettings, but I'd recon that ports and ip are what most tool require.

skorhone pushed a commit to skorhone/libpod that referenced this issue Jul 3, 2020
… NetworkSettings/Ports

Implement mapping for NetworkSettings/Ports for Container inspect endpoint

Signed-off-by: Sami Korhonen <[email protected]>
@skorhone
Copy link
Author

skorhone commented Jul 3, 2020

Tested locally on Ubuntu 20.04 LTS

skorhone pushed a commit to skorhone/libpod that referenced this issue Jul 7, 2020
… NetworkSettings/Ports

Implement mapping for NetworkSettings/Ports for Container inspect endpoint

Signed-off-by: Sami Korhonen <[email protected]>
@skorhone
Copy link
Author

skorhone commented Jul 7, 2020

Closed by #6852

@skorhone skorhone closed this as completed Jul 7, 2020
@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 23, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
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

No branches or pull requests

3 participants