Coder Social home page Coder Social logo

Comments (9)

K4rakara avatar K4rakara commented on May 29, 2024

Upon inspecting the code, this appears to be happening because the only part of the port mapping that gets read is the protocol, not the host/container port, ip address, etc. I would say that would be the root issue, but on a local unix socket connection I don't have the same issue.

For example, on a container that was created with --publish 5173:80:

Some(
    PortMapping {
        container_port: None,
        host_ip: None,
        host_port: None,
        protocol: Some(
            "tcp",
        ),
        range: None,
    },
)

from pods.

marhkb avatar marhkb commented on May 29, 2024

Thanks for reporting.
Reading the documentation, it seems that Podman uses a random port if the field host_port is being omitted.

HostPort is the port number that will be forwarded from the host into the container. If omitted, a random port on the host (guaranteed to be over 1024) will be assigned.

But in this case, it shouldn't do this because of --publish 5173:80.

but on a local unix socket connection I don't have the same issue.

This is indeed weird. What version of Podman are you using?

from pods.

K4rakara avatar K4rakara commented on May 29, 2024

I'm using podman version 4.3.1 on my laptop, 3.0.1 on my server. Perhaps thats the issue?

from pods.

marhkb avatar marhkb commented on May 29, 2024

Yeah, probably. The version is so old it even isn't listed anymore on the API reference overview :-)
https://docs.podman.io/en/latest/Reference.html

For my understanding: You are using the unix socket for 4.3.1 and the TCP socket for 3.0.1?

I think there wouldn't be an error if you'd expose the 4.3.1 via TCP podman instance and connect to that?

I will try to setup a VM with that particular podman version for reproduction purposes in the next days.

from pods.

K4rakara avatar K4rakara commented on May 29, 2024

Correct, that's the setup (a certified Debian moment if I say so myself)

In the meantime I'll try to see if I can use a backport of a newer podman on the server.

from pods.

marhkb avatar marhkb commented on May 29, 2024

What you could also try is to change the problematic line

mapping.host_port.unwrap(),

To somethting like this

mapping.host_port.unwrap_or(80),

In this we, we can check whether more errors may follow

from pods.

K4rakara avatar K4rakara commented on May 29, 2024

It looks like everything works after that! I can view the images, containers, processes, etc all just fine.

from pods.

marhkb avatar marhkb commented on May 29, 2024

Ok, I've set up the debian VM. The problem is that podman 3.0 uses camelCase for the "Ports" field names

❯ curl http://bullseye:37017/v3.0.1/libpod/containers/json
[{"AutoRemove":false,"Command":["/bin/sh"],"Created":"2023-01-30T20:58:12.329067206+01:00","CreatedAt":"","Exited":false,"ExitedAt":-62135596800,"ExitCode":0,"Id":"9c6a10c729bfbbc5d9fee00e645daa4839bfca68a5a425d8cd7fdf3e9fd8c517","Image":"docker.io/library/alpine:latest","ImageID":"042a816809aac8d0f7d7cacac7965782ee2ecac3f21bcf9f24b1de1a7387b769","IsInfra":false,"Labels":null,"Mounts":[],"Names":["flagrant-record"],"Namespaces":{},"Networks":["podman"],"Pid":797,"Pod":"","PodName":"","Ports":[{"hostPort":5555,"containerPort":5555,"protocol":"tcp","hostIP":""}],"Size":null,"StartedAt":1675108693,"State":"running","Status":""}]

Since 3.1 podman uses snake_case

"Ports":[{"host_ip":"","container_port":35017,"host_port":35017,"range":1,"protocol":"tcp"}],

See the documentation

Unfortunately, the library podman-api-rs, which Pod uses, doesn't cover this.

I can work around this specific issue by showing a "?" instead of an actual port number. But IMHO, it would be the best approach to upgrade to 3.1 since 3.0 is basically undocumented at this point.

from pods.

marhkb avatar marhkb commented on May 29, 2024

I decided to not show the port if it is absence. Please feel free to report all the bugs you encounter! Let's see how many of them we can actually fix.

from pods.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.