Bind to public IP address from a rootless podman container

191 views Asked by At

How to run a rootless podman container in a way that the app inside of it can bind to a public IP address, visible from the world ?

Looking at this, it says

To be succinct and simple, when running rootless containers, the container itself does not have an IP address

but I was wondering if there were a workaround or an other to achieve this?

In concrete terms, I run this container as apisix user:

/usr/bin/podman run --name=systemd-apisix --rm -d --log-driver=journald \
  -v /opt/apisix/etc/config.yaml:/usr/local/apisix/conf/config.yaml \
  -v /opt/apisix/etc/apisix.yaml:/usr/local/apisix/conf/apisix.yaml \
  --publish 9080:9080 \
  --env APISIX_STAND_ALONE=True \
  docker.io/apache/apisix:3.5.0-redhat

And I see the following in /var/log/messages:

systemd-apisix[110624]: 2023/11/14 13:45:03 [emerg] 1#1: bind() to 10.20.30.40:9080 failed (99: Cannot assign requested address)
systemd-apisix[110624]: nginx: [emerg] bind() to 10.20.30.40:9080 failed (99: Cannot assign requested address)
0

There are 0 answers