Container can't resolve hostname (but Host OS works fine)

Hi,

We have a customer with a setup in which a container can’t resolve an ip address. The device is on a guest network that might have some restrictions but Balena can successfully access the cloud and the Host shell can successfully resolve the DNS.

For example:
curl https://www.google.com
is successful in Host OS shell

but it fails in any of the containers:
curl: (6) Could not resolve host: www.google.com

Note that the same app/image works fine in other locations.

Any idea why this fails?

Thanks!

Hey,

So it looks like the customer’s network is:
inet addr:172.18.0.100 Bcast:172.18.0.255 Mask:255.255.255.0

Whereas balena is using, inside the container, the following subnet:
inet 172.18.0.4 netmask 255.255.0.0 broadcast 172.18.255.255

So, basically, the balena subnet is overlapping with the customer subnet.

Is there a way to change it? why is balena using a 255.255.0.0 subnet network?

Thanks!

Ok - figured it out.

For anyone bumping into this in the future, the solution was to configure the default bridging network used for the containers.

Adding the following lines to the docker-compose.yml solved the problem:
networks:
default:
ipam:
driver: default
config:
- subnet: “172.21.21.0/24”
- subnet: “2001:3984:3989::/64”