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-compose port should consult podman port command #778

Open
Apxdono opened this issue Sep 21, 2023 · 0 comments
Open

podman-compose port should consult podman port command #778

Apxdono opened this issue Sep 21, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@Apxdono
Copy link

Apxdono commented Sep 21, 2023

Is your feature request related to a problem? Please describe.

As of today podman-compose consults the actual Compose YAML file to get information about ports and assumes that ports are expected to have direct mappings to host, like 8080:80 etc. Otherwise a ValueError: not enough values to unpack (expected 2, got 1) exception is thrown after unpacking.

I presume this was the compromise of providing "at least something", while podman had issues with properly publishing exposed ports and supplying this information via inspect <container> command.

And starting with podman 4.6.x I suspect things can shape up for the better.

Describe the solution you'd like

Latest versions of Podman (>=4.6.0) now correctly supplies all published ports information via podman inspect <container>. This allows podman-compose to take advantage of this, and provide this information as well. A "positive" side-effect of this change - podman-compose becomes more aligned with behavior and output of docker-compose, making switching from Docker to Podman even more appealing to the public (same goes for alias docker-compose=postman-compose).

Another benefit: additional tooling unlocks better support for Podman.
I can definitively say that with proposed change in place testcontainers for python (and mb Java, but I need to check this claim) will start functioning correctly when querying port information. For compose style containers they rely on information from (podman)docker-compose port <container> <port>

Describe alternatives you've considered

The only other alternative is to use podman port command to get this data. This approach does not apply or as easy to implement as soon as you rely on some other tool/abstraction (that has baked-in support for *-compose style commands) instead of direct communication with Docker/Podman clients/sockets: case in point - testcontainers.

Additional context

In case you're looking for analogous output from docker-compose I got you covered

When container is running

$ docker-compose port kong 9090
0.0.0.0:9090

$ docker port kong 9090
0.0.0.0:9090
[::]:9090

When container is not started

$ docker-compose port kong 9090
service "kong" is not running

$ docker port kong 9090
Error response from daemon: No such container: kong
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant