exposing ports to outside not working (Solved)

Hello team,
a quick question:
I would like to expose few ports to the outside word. This was working before but for whatever reason I cannot get it to work in a way that I want, or I don’t remember how I did it many months ago.
Here is the situation:
currently, we use dbus for some network communication between host and our container. It uses few different interfaces, 4-5 diffrenet ethernet, wifi etc.
In our docker compose if we change the network_mode to bridge the port forwarding/exposing works with no problem, but the downside is most of the interfaces do not work anymore. If we use the host mode which is preferable, the exposed ports do not work.
below is our compose template:
version: ‘2.1’
networks: {}
resin-data: {}
context: {BUILD_CONTEXT} args: base_version: {BASE_APP_TAG}
fw_version: ${GIT_TAG_VERSIO}
privileged: true
restart: always
network_mode: host
- “”
- “”
- “”
- ‘resin-data:/data’
io.balena.features.kernel-modules: ‘1’
io.balena.features.firmware: ‘1’
io.balena.features.dbus: ‘1’
io.balena.features.supervisor-api: ‘1’
io.balena.features.balena-api: ‘1’
io.balena.update.strategy: download-then-kill
Same ports same everything works in bridge mode.
I have tired localhost and no ip as well as only exposed port. On my latest try, I manually added the vpn ip address.
On my client side I always use balena tunnel and telnet to test the port.
In any of my tries other than bridge, I get the 500 https error: => ===> :: Unable to connect: 500 Internal Server Error
One of the application is similar to this, https://www.balena.io/blog/running-a-gui-application-with-balenacloud/ .
And this works no problem in bridge mode. I’m thinking maybe i need to define the interface somehow under networks label. One other thing which i’m not sure if it is correct or not is that the balena engine ps under ports column does not show any port for the service on the hostOS side, and I’m assuming if the port is properly exposed, this should show it.
Thank you for your help.
PS: I made sure everything has been correctly setup inside the container, in other words, a service is listening on these ports

Hi, since the network mode is host, can you try to remove ports section completely and request directly to <device_ip>:5900 or <device_ip>: 5000 ?

1 Like

It beautifully works.
Thank you

I’m glad the problem has solved, have a good day!