Home Assistant + InfluxDB 2 DNS problem

I installed InfluxDB2 and would like to connect Home Assistant to it. The only way I could do this was by passing the container’s IP directly in the configuration, as shown below:

influxdb:
  api_version: 2
  ssl: false
  host: 10.21.0.3
  port: 8086
  token: 'xxx'
  organization: 'homeassistant'
  bucket: home_assistant
  max_retries: 10
  default_measurement: state

The problem is, the container IP changes every time Umbrel reboots.

Tried with influxdb2_app_1 or http://influxdb2_app_1 for the host parameter, but I receive a connection error on HA logs:

Cannot connect to InfluxDB due to '<urllib3.connection.HTTPConnection object at 0x7f717d1160>: Failed to establish a new connection: [Errno -2] Name does not resolve'. Please check that the provided connection details (host, port, etc.) are correct and that your InfluxDB server is running and accessible. Retrying in 60 seconds.

Btw I can connect Grafana with Influx passing the following url: http://influxdb2_app_1:8086.

How does HA handle DNS for containers in Umbrel? What is the alternative to connect to Influx persistently, without having to change the configuration from time to time?

give it a fixed IP address.

How I can do this in Umbrel, since InfluxDB is a Umbrel app?

DarthCoin has you covered.
How to set a static IP for your Umbrel server

I’m not sure if this is what you are asking.