Opening up a host port on Balena container

Hello,

Ive been trying to implement Redis Simple Message Queue(https://github.com/smrchy/rsmq#readme) on my Banlena project, Ive added
network_mode: host to my docker compose

But when I try and run a function like this.rmsq.listQueues(callback
It just hangs, I think its to do with the internal network, Ive instantiated the class as follows:
this.rsmq = new RedisSMQ({ host: “127.0.0.1”, port: 6379, ns: “rsmq” });

If i try ping 127.0.0.1:6379
I get a “Name or service not known”
Do you know how I can open up this port to be used?

I also tried setting the Port on docker-compose:
ports:
- “6379:6379”

Hi @PatrickEntabeni, at first thought, it seems like you need to expose that port by adding EXPOSE 6379 line to your dockerfile. You could read about EXPOSE directive and more in this masterclass: https://www.balena.io/docs/learn/more/masterclasses/docker-masterclass/#65-expose-directive

We also have 2 example projects using Redis in a Balena project:


Hope these help. Let us know how it goes.

1 Like

Thanks @gelbal

Ill give that a try