Using podman container with port-mapping networking #24988
-
Hi all. I have a following case - I'd like to use in my CI pipelines testcontainers. To be able to use it a container engine (Docker, Podman, etc) must be running somewhere (locally or over a network) and testcontainers uses the The problem is that this approach works perfectly with Docker running as a container engine, but doesn't work with Podman. As a test I've used an example with Postgresql.
Here is an example of a Pod's manifest how it works with Docker - https://pastebin.com/raw/QrJhq9rb In both cases I do the following (for example, with Podman - with Docker it's the same):
The output of the last command is
If we have a look at the podman container we can see an error
It looks like the difference is that the docker (dind) container can allocate per nested containers IP-addresses and use port-mapping while Podman can't. Is any workaround for Podman to use it with testcontainers? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
This is because the podman image defaults to host namesapces for most things to enable it to better work in restricted envs, i.e. where we cannot configure networking. You can remove the default from there in the container. |
Beta Was this translation helpful? Give feedback.
This is because the podman image defaults to host namesapces for most things to enable it to better work in restricted envs, i.e. where we cannot configure networking.
https://github.com/containers/image_build/blob/main/podman/containers.conf
You can remove the default from there in the container.