ENV for the `UMBREL_IP`
Short version
Is there is a way to get the Umbrel IP ?
Details
I have an App made of a few containers. One container exposes a service (prometheus metrics...) on :9615. The IP for this container is set so I know the internal IP.
Docker is set to expose :9615 (:28415 but this is a random pick and this is not very relevant...)
-
curl http://localhost:28415/metricsfrom the Umbrel server => OK -
http://10.211.55.20:28415/metricsfrom "outside" => OK (10.211.55.20is the IP Umbrel got)
I have a container that runs a static site.
This site runs in the user's browser so it needs the public IP of the Umbrel server: 10.211.55.20 in order to access the prometheus metrics.
How can I retreive the Umbrel external IP in order to pass it as an ENV to my nginx container ?
I believe you can just point the IP address to the Umbrel's container name and your site will open in the browser fine.
Hey @chevdor, the easiest way to have container's talk to each other is to leverage Docker DNS. So as @IMPranshu says you would use the name of the docker container that you want to communicate with, and Docker DNS will resolve this name to the container's IP address.
See the Immich app, for example, where the container name (immich_machine-learning_1) is used as the hostname in this environment variable:
https://github.com/getumbrel/umbrel-apps/blob/d3a0d959f92a9de851a5b55b59b196906388ffb1/immich/docker-compose.yml#L15
Docker DNS will then resolve this to the container's IP for you.
Is there is a way to get the Umbrel IP ?
But if you are looking to get the local IP of your Umbrel device, the current way you would do that is by running something like:
hostname --all-ip-addresses
...and parsing the IP address you want.
See Nextcloud as an example: https://github.com/getumbrel/umbrel-apps/blob/master/nextcloud/exports.sh