resin-dns not working

I have a docker-compose with multiple services. Most of them are defined as network_mode: bridge and the others as host.
One of the containers used is linuxserver/swag as reversed proxy. According to all documentation I should be able to use the container name to direct to another container. For example in the proxy conf:

        set $upstream_app homeassistant;
        set $upstream_port 8123;
        set $upstream_proto http;
        proxy_pass $upstream_proto://$upstream_app:$upstream_port;

However as long as homeassistant is there (which is there as container) it doesn’t work. It only works when I replace it with an IP.
If I do nslookup [container] from within any of the containers and picking a random other container the only thing I get is:

nslookup mosquitto
Server:         10.114.102.1
Address:        10.114.102.1#53

Non-authoritative answer:
*** Can't find mosquitto: No answer

or

nslookup ebusd
Server:         10.114.102.1
Address:        10.114.102.1:53

Non-authoritative answer:

Non-authoritative answer:

To my understanding this should be resolved by resin-dns which is 10.114.102.1; now I’m wondering why this isn’t working?

So, if I understand correctly you want a request coming into your device to be routed to the correct micro-service.

I think the first step is to remove the network_mode’s everywhere. It’s not needed when you’re going to run a reverse proxy anyways (only when you want to do something really exotic).

Then in your docker-compose you expose all relevant ports you want on the reverse proxy container.

For http and https respectively it will be 80, 443 but you can just as easily expose the mqtt port (1883) or any other port. (Except for reserved ones that balenaos uses such as 22222)

Them it’s just a matter of configuring your reverse proxy correctly to point to the containers.

Whenever you use network_mode host (and I think bridged too, but I’m not 100% sure) the resolving will not be handled by the dockers internal dns/resolver anymore.

So to sum up, expose your necessary ports on the reverse proxy container and then route to the appropriate docker containers using the reverse proxy config.