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 port' doesn't work correctly when passed a port number #3747

Closed
KurtGaastra opened this issue Aug 7, 2019 · 1 comment · Fixed by #3750
Closed

'podman port' doesn't work correctly when passed a port number #3747

KurtGaastra opened this issue Aug 7, 2019 · 1 comment · Fixed by #3750
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

@KurtGaastra
Copy link

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.

  1. 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

  2. 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

  3. (Minor) One of the resulting error messages is incomplete because it uses an unassigned variable containerName

Steps to reproduce the issue:

  1. podman run --rm -d -p 9999:5432 -p 9998:5433 postgres

  2. podman port --latest 5432

Describe the results you received:

Error: No public port '5432' published for

Describe the results you expected:

0.0.0.0:9999
0.0.0.0:9998

Steps to reproduce the issue:

  1. podman run -d --name port_test -p 9999:5432 postgres

  2. 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:

Version:            1.4.4
RemoteAPI Version:  1
Go Version:         go1.10.4
OS/Arch:            linux/amd64

Also tested against build from master.

@openshift-ci-robot openshift-ci-robot added the kind/bug Categorizes issue or PR as related to a bug. label Aug 7, 2019
@mheon
Copy link
Member

mheon commented Aug 7, 2019

@baude If you haven't started on this, I can take it.

baude added a commit to baude/podman that referenced this issue Aug 7, 2019
when listing multiple ports on a container with podman port, an early
return was limiting results.

Fixes: containers#3747

Signed-off-by: baude <bbaude@redhat.com>
gabibeyer pushed a commit to gabibeyer/libpod that referenced this issue Aug 15, 2019
when listing multiple ports on a container with podman port, an early
return was limiting results.

Fixes: containers#3747

Signed-off-by: baude <bbaude@redhat.com>
gabibeyer pushed a commit to gabibeyer/libpod that referenced this issue Aug 16, 2019
when listing multiple ports on a container with podman port, an early
return was limiting results.

Fixes: containers#3747

Signed-off-by: baude <bbaude@redhat.com>
@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

Successfully merging a pull request may close this issue.

4 participants