'podman port' doesn't work correctly when passed a port number #3747
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.
Is this a BUG REPORT or FEATURE REQUEST? (leave only one on its own line)
/kind bug
Description
podman port
doesn't work correctly when passed a port number.There are a few problems.
If the container has multiple ports published then only the first one is matched. See the early return on cmd/podman/port.go:Line 131
When you specify a container by name it doesn't work at all.
In cmd/podman/port.go, func portCmd(c *cliconfig.PortValues)
c.InputArgs is handled correctly, and the container name and port are correctly extracted
Line 100: c is then passed to runtime.Port(c) where c.InputArgs gets treated as a list of container names
(Minor) One of the resulting error messages is incomplete because it uses an unassigned variable
containerName
Steps to reproduce the issue:
podman run --rm -d -p 9999:5432 -p 9998:5433 postgres
podman port --latest 5432
Describe the results you received:
Describe the results you expected:
Steps to reproduce the issue:
podman run -d --name port_test -p 9999:5432 postgres
podman port port_test 5432
Describe the results you received:
No output on version 1.4.4
When built from master the error message
Error: no container with name or ID 5432 found: no such container
Describe the results you expected:
0.0.0.0:9999
Output of
podman version
:Also tested against build from master.
The text was updated successfully, but these errors were encountered: