what is the most recommended way to check if device is connected

Hi,
i want to make that internet is available inside a container, whats the most recommended way to it? should i query a balena host? (i know i can just ping somewhere, but i’m looking for the most reliable way, maybe balenaOS has a built in feature for that)

Hi @mellerdaniel,

The heartbeat icon on the device dashboard tells you if the HostOS (and device) is online via the balena VPN, but that won’t indicate whether a specific container has an Internet connection. Using ping or curl from inside the container should work (i.e. ping 8.8.8.8) for outgoing connections. For incoming connections, if your container has an exposed port (like 80), you can enable the device’s Public Device URL and access that port from outside your network. That would require explicitly exposing that port in your docker-compose.yml or Dockerfile.

John